/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.1.135
 Source Server Type    : SQL Server
 Source Server Version : 10501600
 Source Host           : 192.168.1.135\SQL2008:1433
 Source Catalog        : DMHR
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 10501600
 File Encoding         : 65001

 Date: 01/05/2019 10:21:00
*/


-- ----------------------------
-- Table structure for chengshib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[chengshib]') AND type IN ('U'))
	DROP TABLE [dbo].[chengshib]
GO

CREATE TABLE [dbo].[chengshib] (
  [daima] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [sheng] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [shi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [quhao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [youbian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[chengshib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for daiyub
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[daiyub]') AND type IN ('U'))
	DROP TABLE [dbo].[daiyub]
GO

CREATE TABLE [dbo].[daiyub] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ming] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dengji] int  NULL,
  [shibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zt] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[daiyub] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ddbreakrule
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddbreakrule]') AND type IN ('U'))
	DROP TABLE [dbo].[ddbreakrule]
GO

CREATE TABLE [dbo].[ddbreakrule] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [CarNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [SjNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [SjName] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [BreakRuleInfo] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [BreakRulePlace] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [Score] int  NULL,
  [Fine] int  NULL,
  [BreakRuleTime] datetime  NULL,
  [DealTime] datetime  NULL,
  [CreateManNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateManName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateTime] datetime  NULL,
  [Remark] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [DealFlag] int DEFAULT ((0)) NULL,
  [DealManNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DealManName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ddbreakrule] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'车牌号',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'CarNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'司机员工编号',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'SjNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'司机姓名',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'SjName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'违章信息',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'BreakRuleInfo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'违章地点',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'BreakRulePlace'
GO

EXEC sp_addextendedproperty
'MS_Description', N'积分',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'Score'
GO

EXEC sp_addextendedproperty
'MS_Description', N'罚款',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'Fine'
GO

EXEC sp_addextendedproperty
'MS_Description', N'违章时间',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'BreakRuleTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'处理时间',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'DealTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'录入人编号',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'CreateManNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'录入人姓名',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'CreateManName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否处理标志（0：未处理；1：已处理）',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'DealFlag'
GO

EXEC sp_addextendedproperty
'MS_Description', N'处理人编号',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'DealManNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'处理人姓名',
'SCHEMA', N'dbo',
'TABLE', N'ddbreakrule',
'COLUMN', N'DealManName'
GO


-- ----------------------------
-- Table structure for ddcar
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddcar]') AND type IN ('U'))
	DROP TABLE [dbo].[ddcar]
GO

CREATE TABLE [dbo].[ddcar] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [CarNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CarType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CarBrand] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CarTypeNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CarSBNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EngineNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RecordDate] date  NULL,
  [HaveLicenseDate] date  NULL,
  [RecordNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadNumber] int  NULL,
  [InspectionPeriod] date  NULL,
  [CarStatus] int  NULL,
  [CarInfos] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [Mileage] int  NULL,
  [HandOrAuto] int  NULL,
  [EditDate] date  NULL,
  [EditMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [UseStatus] int  NULL,
  [EditNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DelStatus] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[ddcar] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ddcardispatch
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddcardispatch]') AND type IN ('U'))
	DROP TABLE [dbo].[ddcardispatch]
GO

CREATE TABLE [dbo].[ddcardispatch] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [Status] int  NULL,
  [CreateDate] date  NULL,
  [YueStore] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueManNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ArrivePlace] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueStartDate] datetime  NULL,
  [YueEndDate] datetime  NULL,
  [YueReason] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueBm] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueManNumber] int  NULL,
  [YueGoods] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [YueSpecialExplain] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [PaiCarNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PaiMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PaiDate] datetime  NULL,
  [InputMan1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PaiCheDate] datetime  NULL,
  [PaiCheReason] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [PaiCheMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [FanPlace] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [FanKilometers] int  NULL,
  [FanCost] decimal(18,2)  NULL,
  [FanRemark] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [FanDate] datetime  NULL,
  [PaiIsOrNotPin] int  NULL,
  [DocNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [FanStartKilo] int  NULL,
  [FanEndKilo] int  NULL,
  [YueCheReason] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ddcardispatch] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ddcarman
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddcarman]') AND type IN ('U'))
	DROP TABLE [dbo].[ddcarman]
GO

CREATE TABLE [dbo].[ddcarman] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [UserNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Store] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Bm] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Name] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DriveYears] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [StartHaveLicenseDate] date  NULL,
  [CanUseCarType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Status] int  NULL,
  [EditMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EditDate] date  NULL,
  [Sex] int  NULL,
  [Birthday] date  NULL,
  [LicenseUntil] date  NULL,
  [CardNo] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [RecordNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EditNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DelStatus] int  NULL,
  [PhoneNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [BrFlag] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[ddcarman] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否违章标志（0：未违章 1：违章）',
'SCHEMA', N'dbo',
'TABLE', N'ddcarman',
'COLUMN', N'BrFlag'
GO


-- ----------------------------
-- Table structure for ddcost
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddcost]') AND type IN ('U'))
	DROP TABLE [dbo].[ddcost]
GO

CREATE TABLE [dbo].[ddcost] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [DocNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [GaosuCost] decimal(18,2)  NULL,
  [StandCost] decimal(18,2)  NULL,
  [OtherCost] decimal(18,2)  NULL
)
GO

ALTER TABLE [dbo].[ddcost] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ddpaiman
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddpaiman]') AND type IN ('U'))
	DROP TABLE [dbo].[ddpaiman]
GO

CREATE TABLE [dbo].[ddpaiman] (
  [UserNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Name] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PhoneNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ddpaiman] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ddrefuel
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddrefuel]') AND type IN ('U'))
	DROP TABLE [dbo].[ddrefuel]
GO

CREATE TABLE [dbo].[ddrefuel] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [CarNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RefuelTime] datetime  NULL,
  [CarMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Mileage] int  NULL,
  [RefuelNum] decimal(18,2)  NULL,
  [Price] decimal(18,2)  NULL,
  [Money] decimal(18,2)  NULL,
  [Remark] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CreateTime] datetime  NULL
)
GO

ALTER TABLE [dbo].[ddrefuel] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'车牌号',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'CarNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'加油时间',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'RefuelTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'驾驶人',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'CarMan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公里数',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'Mileage'
GO

EXEC sp_addextendedproperty
'MS_Description', N'加油量',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'RefuelNum'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单价',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'Price'
GO

EXEC sp_addextendedproperty
'MS_Description', N'金额',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'Money'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'录入人',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'CreateMan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'ddrefuel',
'COLUMN', N'CreateTime'
GO


-- ----------------------------
-- Table structure for ddservice
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddservice]') AND type IN ('U'))
	DROP TABLE [dbo].[ddservice]
GO

CREATE TABLE [dbo].[ddservice] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [CarNo] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDate] date  NULL,
  [ServiceMan] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceFactory] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceInfo] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [MaterialMoney] decimal(18,2)  NULL,
  [ManhourMoney] decimal(18,2)  NULL,
  [TotalMoney] decimal(18,2)  NULL,
  [CreateTime] datetime  NULL,
  [CreateMan] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [Remark] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ddservice] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'维修车辆车牌号',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'CarNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维修日期',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'ServiceDate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维修人',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'ServiceMan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修理厂',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'ServiceFactory'
GO

EXEC sp_addextendedproperty
'MS_Description', N'材料费明细',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'ServiceInfo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'材料费合计',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'MaterialMoney'
GO

EXEC sp_addextendedproperty
'MS_Description', N'工时费合计',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'ManhourMoney'
GO

EXEC sp_addextendedproperty
'MS_Description', N'总金额',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'TotalMoney'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'CreateMan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'ddservice',
'COLUMN', N'Remark'
GO


-- ----------------------------
-- Table structure for ddTrafficCon
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ddTrafficCon]') AND type IN ('U'))
	DROP TABLE [dbo].[ddTrafficCon]
GO

CREATE TABLE [dbo].[ddTrafficCon] (
  [Place] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Mon] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Tus] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Wen] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Ths] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Fri] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Sat] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Sun] varchar(20) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ddTrafficCon] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for EquBasic
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[EquBasic]') AND type IN ('U'))
	DROP TABLE [dbo].[EquBasic]
GO

CREATE TABLE [dbo].[EquBasic] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [EquName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LifeTime] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [StartTime] datetime  NULL,
  [EndTime] datetime  NULL,
  [BuyInMoney] decimal(18,5)  NULL,
  [QualityScore] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LastConseTime] datetime  NULL,
  [NextConseTime] datetime  NULL,
  [EquType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [PurchaseType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EquLabel] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Store] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EquStatus] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EquNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ConsePeriod] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Specification] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Place] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServCondition] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [BuyInTime] datetime  NULL,
  [InputMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[EquBasic] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'资产名称',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'EquName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'寿命',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'LifeTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'开始使用时间',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'StartTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'截止使用时间',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'EndTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'购入金额',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'BuyInMoney'
GO

EXEC sp_addextendedproperty
'MS_Description', N'上次定期维护时间',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'LastConseTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类别',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'EquType'
GO

EXEC sp_addextendedproperty
'MS_Description', N'购置方式',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'PurchaseType'
GO

EXEC sp_addextendedproperty
'MS_Description', N'门店',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'Store'
GO

EXEC sp_addextendedproperty
'MS_Description', N'资产状态',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'EquStatus'
GO

EXEC sp_addextendedproperty
'MS_Description', N'资产编号',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'EquNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维护周期',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'ConsePeriod'
GO

EXEC sp_addextendedproperty
'MS_Description', N'型号-规格',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'Specification'
GO

EXEC sp_addextendedproperty
'MS_Description', N'安装地点',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'Place'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用状况',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'ServCondition'
GO

EXEC sp_addextendedproperty
'MS_Description', N'购入时间',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'BuyInTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'录入人',
'SCHEMA', N'dbo',
'TABLE', N'EquBasic',
'COLUMN', N'InputMan'
GO


-- ----------------------------
-- Table structure for EquBasicImage
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[EquBasicImage]') AND type IN ('U'))
	DROP TABLE [dbo].[EquBasicImage]
GO

CREATE TABLE [dbo].[EquBasicImage] (
  [ImageUrl] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [ID] int  IDENTITY(1,1) NOT NULL,
  [EquNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[EquBasicImage] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'图片存放相对路径',
'SCHEMA', N'dbo',
'TABLE', N'EquBasicImage',
'COLUMN', N'ImageUrl'
GO

EXEC sp_addextendedproperty
'MS_Description', N'资产编号',
'SCHEMA', N'dbo',
'TABLE', N'EquBasicImage',
'COLUMN', N'EquNo'
GO


-- ----------------------------
-- Table structure for EquConserve
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[EquConserve]') AND type IN ('U'))
	DROP TABLE [dbo].[EquConserve]
GO

CREATE TABLE [dbo].[EquConserve] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [DocNo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DocStatus] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [EquId] int  NULL,
  [CreateTime] datetime  NULL,
  [ConseType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ConseResult] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [Store] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [InputMan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ConseTime] datetime  NULL,
  [ConseReason] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Cost] decimal(18,5)  NULL
)
GO

ALTER TABLE [dbo].[EquConserve] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'单据编号',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'DocNo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单据状态',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'DocStatus'
GO

EXEC sp_addextendedproperty
'MS_Description', N'资产id',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'EquId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维护类型（1：养护 2：维修）',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'ConseType'
GO

EXEC sp_addextendedproperty
'MS_Description', N'门店',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'Store'
GO

EXEC sp_addextendedproperty
'MS_Description', N'录入人',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'InputMan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维护时间',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'ConseTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'维护原因',
'SCHEMA', N'dbo',
'TABLE', N'EquConserve',
'COLUMN', N'ConseReason'
GO


-- ----------------------------
-- Table structure for EquSetting
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[EquSetting]') AND type IN ('U'))
	DROP TABLE [dbo].[EquSetting]
GO

CREATE TABLE [dbo].[EquSetting] (
  [ID] int  IDENTITY(1,1) NOT NULL,
  [SetKey] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [SetValue] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[EquSetting] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for fafenb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[fafenb]') AND type IN ('U'))
	DROP TABLE [dbo].[fafenb]
GO

CREATE TABLE [dbo].[fafenb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [fj_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [fj_ri] datetime  NULL,
  [fj_leiid] int  NULL,
  [fj_leiming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [fj_fa] int  NULL,
  [fj_fen] int  NULL,
  [fj_jiaofa] int DEFAULT ((0)) NULL,
  [fj_jiaori] datetime  NULL,
  [fj_zhinajin] int DEFAULT ((0)) NULL,
  [fj_shibie] int DEFAULT ((0)) NULL,
  [fj_jiaofangshi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [fj_gairen] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [fj_gairi] datetime  NULL
)
GO

ALTER TABLE [dbo].[fafenb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'处罚类别识别，0公司规定，1部门规定',
'SCHEMA', N'dbo',
'TABLE', N'fafenb',
'COLUMN', N'fj_shibie'
GO


-- ----------------------------
-- Table structure for fenxi_set
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[fenxi_set]') AND type IN ('U'))
	DROP TABLE [dbo].[fenxi_set]
GO

CREATE TABLE [dbo].[fenxi_set] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [fuzhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[fenxi_set] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for gdb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[gdb]') AND type IN ('U'))
	DROP TABLE [dbo].[gdb]
GO

CREATE TABLE [dbo].[gdb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [gd_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_dongqian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_donghou] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_gangwei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_ri] datetime  NULL,
  [gd_liyou] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gd_renri] datetime  NULL
)
GO

ALTER TABLE [dbo].[gdb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for gwb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[gwb]') AND type IN ('U'))
	DROP TABLE [dbo].[gwb]
GO

CREATE TABLE [dbo].[gwb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [gw] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [xitong] int  NULL,
  [zt] bit DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[gwb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for jiaquerenb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[jiaquerenb]') AND type IN ('U'))
	DROP TABLE [dbo].[jiaquerenb]
GO

CREATE TABLE [dbo].[jiaquerenb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [qr_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [qr_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qr_yue] date  NULL,
  [qr_ri] datetime  NULL,
  [qr_lei] int  NULL,
  [qr_zt] int  NULL,
  [qr_piren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qr_piyijian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qr_piri] datetime  NULL
)
GO

ALTER TABLE [dbo].[jiaquerenb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'0本月清,1下月倒',
'SCHEMA', N'dbo',
'TABLE', N'jiaquerenb',
'COLUMN', N'qr_lei'
GO

EXEC sp_addextendedproperty
'MS_Description', N'审批状态,0待批,1已批,2拒绝',
'SCHEMA', N'dbo',
'TABLE', N'jiaquerenb',
'COLUMN', N'qr_zt'
GO


-- ----------------------------
-- Table structure for jiaxiusetb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[jiaxiusetb]') AND type IN ('U'))
	DROP TABLE [dbo].[jiaxiusetb]
GO

CREATE TABLE [dbo].[jiaxiusetb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zhiwu] int  NULL,
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tian] int DEFAULT ((0)) NULL,
  [daiyu] int  NULL
)
GO

ALTER TABLE [dbo].[jiaxiusetb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'年假和公休设置表',
'SCHEMA', N'dbo',
'TABLE', N'jiaxiusetb',
'COLUMN', N'id'
GO


-- ----------------------------
-- Table structure for jiejiab
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[jiejiab]') AND type IN ('U'))
	DROP TABLE [dbo].[jiejiab]
GO

CREATE TABLE [dbo].[jiejiab] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [jiaming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jia] decimal(18,1)  NULL,
  [xiuqiri] date  NULL,
  [xiuzhiri] date  NULL,
  [jiashunian] date  NULL,
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[jiejiab] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for jigoudiguib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[jigoudiguib]') AND type IN ('U'))
	DROP TABLE [dbo].[jigoudiguib]
GO

CREATE TABLE [dbo].[jigoudiguib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [zhu] int  NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jibie] int  NULL,
  [xitong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [shibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dianshun] int  NULL,
  [zonganddianxitong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zt] float(53) DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[jigoudiguib] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'总部部门对应的店面部门',
'SCHEMA', N'dbo',
'TABLE', N'jigoudiguib',
'COLUMN', N'zonganddianxitong'
GO


-- ----------------------------
-- Table structure for kq_yuejie
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kq_yuejie]') AND type IN ('U'))
	DROP TABLE [dbo].[kq_yuejie]
GO

CREATE TABLE [dbo].[kq_yuejie] (
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gongxiu] decimal(18,1)  NULL,
  [shuyue] date  NULL,
  [chuqin] decimal(18,1)  NULL,
  [weichuqin] decimal(18,1)  NULL,
  [benyueqingjia] decimal(18,1)  NULL,
  [shangyueyuxiu] decimal(18,1)  NULL,
  [xiujiejia] decimal(18,1)  NULL,
  [xiugongxiu] decimal(18,1)  NULL,
  [daoxiu] decimal(18,1)  NULL,
  [shijia] decimal(18,1)  NULL,
  [qitajia] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [yuchuli] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [chuqintiao] decimal(18,1)  NULL,
  [tiaoyuanyin] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [shiji] decimal(18,1)  NULL,
  [riqi] datetime  NULL,
  [ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[kq_yuejie] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqb]') AND type IN ('U'))
	DROP TABLE [dbo].[kqb]
GO

CREATE TABLE [dbo].[kqb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [k_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [k_ri] datetime  NOT NULL,
  [k_dadi] int  NULL,
  [k_shudi] int  NULL
)
GO

ALTER TABLE [dbo].[kqb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqb1
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqb1]') AND type IN ('U'))
	DROP TABLE [dbo].[kqb1]
GO

CREATE TABLE [dbo].[kqb1] (
  [id] int DEFAULT ((0)) NULL,
  [k_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [k_sri] datetime  NULL,
  [k_sdadi] int  NULL,
  [k_xri] datetime  NULL,
  [k_xdadi] int  NULL,
  [k_shudi] int  NULL,
  [k_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[kqb1] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqb2
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqb2]') AND type IN ('U'))
	DROP TABLE [dbo].[kqb2]
GO

CREATE TABLE [dbo].[kqb2] (
  [id] int  NULL,
  [k_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [k_sri] datetime  NULL,
  [k_sdadi] int  NULL,
  [k_xri] datetime  NULL,
  [k_xdadi] int  NULL,
  [k_shudi] int  NULL,
  [k_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[kqb2] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqbeizhu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqbeizhu]') AND type IN ('U'))
	DROP TABLE [dbo].[kqbeizhu]
GO

CREATE TABLE [dbo].[kqbeizhu] (
  [kb_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [kq_ygid] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [am_beizhu] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Pm_beizhu] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dangtiankqriqi] datetime  NULL,
  [Inputpersons] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [kb_caozuoriqi] datetime  NULL,
  [shibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[kqbeizhu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'本表主键，格式：yyyyMMddygid，同kqb1主键',
'SCHEMA', N'dbo',
'TABLE', N'kqbeizhu',
'COLUMN', N'kb_zhu'
GO

EXEC sp_addextendedproperty
'MS_Description', N'当天考勤日期',
'SCHEMA', N'dbo',
'TABLE', N'kqbeizhu',
'COLUMN', N'dangtiankqriqi'
GO


-- ----------------------------
-- Table structure for kqbeizhuleibie
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqbeizhuleibie]') AND type IN ('U'))
	DROP TABLE [dbo].[kqbeizhuleibie]
GO

CREATE TABLE [dbo].[kqbeizhuleibie] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [leibie] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [queren] int  NULL
)
GO

ALTER TABLE [dbo].[kqbeizhuleibie] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqfsb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqfsb]') AND type IN ('U'))
	DROP TABLE [dbo].[kqfsb]
GO

CREATE TABLE [dbo].[kqfsb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [f_zhuti] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [f_qiri] datetime  NULL,
  [f_zhiri] datetime  NULL,
  [f_yitowushang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [f_yitowuxia] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [f_zhoumoshang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [f_zhoumoxia] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [f_jijie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[kqfsb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqjfb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqjfb]') AND type IN ('U'))
	DROP TABLE [dbo].[kqjfb]
GO

CREATE TABLE [dbo].[kqjfb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [jf_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jf_yue] date  NULL,
  [jf_lei] int  NULL,
  [jf_fen] int  NULL,
  [jf_beizhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[kqjfb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'积分所属年月',
'SCHEMA', N'dbo',
'TABLE', N'kqjfb',
'COLUMN', N'jf_yue'
GO

EXEC sp_addextendedproperty
'MS_Description', N'积分类型',
'SCHEMA', N'dbo',
'TABLE', N'kqjfb',
'COLUMN', N'jf_lei'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所得积分',
'SCHEMA', N'dbo',
'TABLE', N'kqjfb',
'COLUMN', N'jf_fen'
GO


-- ----------------------------
-- Table structure for kqjfleib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqjfleib]') AND type IN ('U'))
	DROP TABLE [dbo].[kqjfleib]
GO

CREATE TABLE [dbo].[kqjfleib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [zhu] int  NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zt] bit DEFAULT ((0)) NULL,
  [beizhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[kqjfleib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqpmb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqpmb]') AND type IN ('U'))
	DROP TABLE [dbo].[kqpmb]
GO

CREATE TABLE [dbo].[kqpmb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [pm_sborxb] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_dian] int  NULL,
  [pm_bumen] int  NULL,
  [pm_gangwei] int  NULL,
  [pm_zhiwu] int  NULL,
  [pm_shibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_dkri] date  NULL,
  [pm_dktime] time(7)  NULL,
  [pm_fenzhong] int  NULL,
  [pm_yueleiji] int  NULL
)
GO

ALTER TABLE [dbo].[kqpmb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'上班还是下班,SB上班,XB下班',
'SCHEMA', N'dbo',
'TABLE', N'kqpmb',
'COLUMN', N'pm_sborxb'
GO

EXEC sp_addextendedproperty
'MS_Description', N'加班或早到分钟数,按照正常标准计算的',
'SCHEMA', N'dbo',
'TABLE', N'kqpmb',
'COLUMN', N'pm_fenzhong'
GO


-- ----------------------------
-- Table structure for kqpmb_paichu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqpmb_paichu]') AND type IN ('U'))
	DROP TABLE [dbo].[kqpmb_paichu]
GO

CREATE TABLE [dbo].[kqpmb_paichu] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [p_bumen] int  NULL,
  [p_gangwei] int  NULL
)
GO

ALTER TABLE [dbo].[kqpmb_paichu] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for kqzb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqzb]') AND type IN ('U'))
	DROP TABLE [dbo].[kqzb]
GO

CREATE TABLE [dbo].[kqzb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [kz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [kz_zaochidao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [kz_xiachidao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [kz_kairi] datetime  NULL,
  [kz_jieri] datetime  NULL
)
GO

ALTER TABLE [dbo].[kqzb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'上午上班迟到标准',
'SCHEMA', N'dbo',
'TABLE', N'kqzb',
'COLUMN', N'kz_zaochidao'
GO

EXEC sp_addextendedproperty
'MS_Description', N'下午上班迟到标准',
'SCHEMA', N'dbo',
'TABLE', N'kqzb',
'COLUMN', N'kz_xiachidao'
GO

EXEC sp_addextendedproperty
'MS_Description', N'标准开始日期',
'SCHEMA', N'dbo',
'TABLE', N'kqzb',
'COLUMN', N'kz_kairi'
GO


-- ----------------------------
-- Table structure for lizhipib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[lizhipib]') AND type IN ('U'))
	DROP TABLE [dbo].[lizhipib]
GO

CREATE TABLE [dbo].[lizhipib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [dian] int  NULL,
  [bumen] int  NULL,
  [piygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[lizhipib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for lizhipirenb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[lizhipirenb]') AND type IN ('U'))
	DROP TABLE [dbo].[lizhipirenb]
GO

CREATE TABLE [dbo].[lizhipirenb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [pizhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [piji] int  NULL,
  [piygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pizt] int DEFAULT ((0)) NULL,
  [piriqi] datetime  NULL
)
GO

ALTER TABLE [dbo].[lizhipirenb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for lizhispb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[lizhispb]') AND type IN ('U'))
	DROP TABLE [dbo].[lizhispb]
GO

CREATE TABLE [dbo].[lizhispb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [lz_dian] int  NULL,
  [lz_bumen] int  NULL,
  [lz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [lz_shenri] datetime  NULL,
  [lz_liri] date  NULL,
  [lz_yuanyin] varchar(400) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_pizt] int DEFAULT ((0)) NULL,
  [lz_che] int DEFAULT ((0)) NULL,
  [lz_cheri] datetime  NULL,
  [lz_yipiren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_ypzt] int DEFAULT ((0)) NULL,
  [lz_yipiri] datetime  NULL,
  [lz_yipiyijian] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_erpiren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_epzt] int DEFAULT ((0)) NULL,
  [lz_erpiri] datetime  NULL,
  [lz_erpiyijian] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[lizhispb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'0申请未批准，1一级审批通过，2董事长审批通过，-1一级审批拒绝，-2董事长审批拒绝',
'SCHEMA', N'dbo',
'TABLE', N'lizhispb',
'COLUMN', N'lz_pizt'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0申请状态，1自己撤销了',
'SCHEMA', N'dbo',
'TABLE', N'lizhispb',
'COLUMN', N'lz_che'
GO


-- ----------------------------
-- Table structure for lzb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[lzb]') AND type IN ('U'))
	DROP TABLE [dbo].[lzb]
GO

CREATE TABLE [dbo].[lzb] (
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [lz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_date] datetime  NULL,
  [lz_dian] int  NULL,
  [lz_bumen] int  NULL,
  [lz_zhiwu] int  NULL,
  [lz_gangwei] int  NULL,
  [lz_jieren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_zhuguan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_zhuguanyijian] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_dianzong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_dianzongyijian] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_zongjian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_zongjianyijian] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_dongshizhangyijian] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_beizhu] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lz_rendate] datetime  NULL,
  [lz_leibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[lzb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for lzleibieb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[lzleibieb]') AND type IN ('U'))
	DROP TABLE [dbo].[lzleibieb]
GO

CREATE TABLE [dbo].[lzleibieb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[lzleibieb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for message
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[message]') AND type IN ('U'))
	DROP TABLE [dbo].[message]
GO

CREATE TABLE [dbo].[message] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [title] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [neirong] text COLLATE Chinese_PRC_CI_AS  NULL,
  [riqi] datetime  NULL,
  [tjr] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [liulanliang] int  NULL,
  [code] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[message] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for mkqxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[mkqxb]') AND type IN ('U'))
	DROP TABLE [dbo].[mkqxb]
GO

CREATE TABLE [dbo].[mkqxb] (
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [mkqx] int  NULL,
  [mkwx] int DEFAULT ((0)) NULL,
  [mkbianji] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[mkqxb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'大数据平台各业务模块访问权限,0人事，1办公，2产品信息',
'SCHEMA', N'dbo',
'TABLE', N'mkqxb',
'COLUMN', N'mkqx'
GO

EXEC sp_addextendedproperty
'MS_Description', N'模块微信端数据编辑权限，0无，1可以',
'SCHEMA', N'dbo',
'TABLE', N'mkqxb',
'COLUMN', N'mkwx'
GO


-- ----------------------------
-- Table structure for oacdqxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[oacdqxb]') AND type IN ('U'))
	DROP TABLE [dbo].[oacdqxb]
GO

CREATE TABLE [dbo].[oacdqxb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [oa_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [oa_caidan1] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [oa_caidan2] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [oa_caidan3] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[oacdqxb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for qjb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[qjb]') AND type IN ('U'))
	DROP TABLE [dbo].[qjb]
GO

CREATE TABLE [dbo].[qjb] (
  [qj_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [qj_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_qiri] date  NULL,
  [qj_qishi] time(7)  NULL,
  [qj_zhiri] date  NULL,
  [qj_zhishi] time(7)  NULL,
  [qj_lei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_liyou] varchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_ri] datetime  NULL,
  [qj_zt] int DEFAULT ((0)) NULL,
  [qj_shen] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_shenliyou] varchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_shenri] datetime  NULL,
  [qj_baoren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qj_tian] decimal(18,1)  NULL,
  [qj_jiejia] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[qjb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for qjmxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[qjmxb]') AND type IN ('U'))
	DROP TABLE [dbo].[qjmxb]
GO

CREATE TABLE [dbo].[qjmxb] (
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jialei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jiayue] date  NULL,
  [jiari] date  NULL,
  [jiaqishi] time(7)  NULL,
  [jiazhishi] time(7)  NULL,
  [jiatian] decimal(18,1)  NULL,
  [qingjiaid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zt] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[qjmxb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'格式:员工id+年月日,如：100820180101',
'SCHEMA', N'dbo',
'TABLE', N'qjmxb',
'COLUMN', N'zhu'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0为假未批，默认，1为已批参与统计,2为已上班作废，不参与统计。',
'SCHEMA', N'dbo',
'TABLE', N'qjmxb',
'COLUMN', N'zt'
GO


-- ----------------------------
-- Table structure for QRTZ_BLOB_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_BLOB_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_BLOB_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_BLOB_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [BLOB_DATA] image  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_BLOB_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_CALENDARS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_CALENDARS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_CALENDARS]
GO

CREATE TABLE [dbo].[QRTZ_CALENDARS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CALENDAR_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CALENDAR] image  NOT NULL
)
GO

ALTER TABLE [dbo].[QRTZ_CALENDARS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_CRON_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_CRON_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_CRON_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_CRON_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CRON_EXPRESSION] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TIME_ZONE_ID] varchar(80) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_FIRED_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_FIRED_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_FIRED_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_FIRED_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ENTRY_ID] varchar(95) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [INSTANCE_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [FIRED_TIME] bigint  NOT NULL,
  [SCHED_TIME] bigint  NOT NULL,
  [PRIORITY] int  NOT NULL,
  [STATE] varchar(16) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [JOB_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [IS_NONCONCURRENT] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [REQUESTS_RECOVERY] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_JOB_DETAILS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_JOB_DETAILS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_JOB_DETAILS]
GO

CREATE TABLE [dbo].[QRTZ_JOB_DETAILS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [DESCRIPTION] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [JOB_CLASS_NAME] varchar(250) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IS_DURABLE] varchar(1) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IS_NONCONCURRENT] varchar(1) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IS_UPDATE_DATA] varchar(1) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [REQUESTS_RECOVERY] varchar(1) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_DATA] image  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_LOCKS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_LOCKS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_LOCKS]
GO

CREATE TABLE [dbo].[QRTZ_LOCKS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [LOCK_NAME] varchar(40) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[QRTZ_LOCKS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_PAUSED_TRIGGER_GRPS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_PAUSED_TRIGGER_GRPS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS]
GO

CREATE TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_SCHEDULER_STATE
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_SCHEDULER_STATE]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_SCHEDULER_STATE]
GO

CREATE TABLE [dbo].[QRTZ_SCHEDULER_STATE] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [INSTANCE_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [LAST_CHECKIN_TIME] bigint  NOT NULL,
  [CHECKIN_INTERVAL] bigint  NOT NULL
)
GO

ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_SIMPLE_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_SIMPLE_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [REPEAT_COUNT] bigint  NOT NULL,
  [REPEAT_INTERVAL] bigint  NOT NULL,
  [TIMES_TRIGGERED] bigint  NOT NULL
)
GO

ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_SIMPROP_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_SIMPROP_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [STR_PROP_1] varchar(512) COLLATE Chinese_PRC_CI_AS  NULL,
  [STR_PROP_2] varchar(512) COLLATE Chinese_PRC_CI_AS  NULL,
  [STR_PROP_3] varchar(512) COLLATE Chinese_PRC_CI_AS  NULL,
  [INT_PROP_1] int  NULL,
  [INT_PROP_2] int  NULL,
  [LONG_PROP_1] bigint  NULL,
  [LONG_PROP_2] bigint  NULL,
  [DEC_PROP_1] numeric(13,4)  NULL,
  [DEC_PROP_2] numeric(13,4)  NULL,
  [BOOL_PROP_1] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [BOOL_PROP_2] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for QRTZ_TRIGGERS
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGERS]') AND type IN ('U'))
	DROP TABLE [dbo].[QRTZ_TRIGGERS]
GO

CREATE TABLE [dbo].[QRTZ_TRIGGERS] (
  [SCHED_NAME] varchar(120) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [JOB_GROUP] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [DESCRIPTION] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [NEXT_FIRE_TIME] bigint  NULL,
  [PREV_FIRE_TIME] bigint  NULL,
  [PRIORITY] int  NULL,
  [TRIGGER_STATE] varchar(16) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [TRIGGER_TYPE] varchar(8) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [START_TIME] bigint  NOT NULL,
  [END_TIME] bigint  NULL,
  [CALENDAR_NAME] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [MISFIRE_INSTR] smallint  NULL,
  [JOB_DATA] image  NULL
)
GO

ALTER TABLE [dbo].[QRTZ_TRIGGERS] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for qxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[qxb]') AND type IN ('U'))
	DROP TABLE [dbo].[qxb]
GO

CREATE TABLE [dbo].[qxb] (
  [qx_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [qx_qx] int  NULL,
  [qx_role] int  NULL
)
GO

ALTER TABLE [dbo].[qxb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'对应角色表里的的角色id',
'SCHEMA', N'dbo',
'TABLE', N'qxb',
'COLUMN', N'qx_role'
GO


-- ----------------------------
-- Table structure for renlian_token
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[renlian_token]') AND type IN ('U'))
	DROP TABLE [dbo].[renlian_token]
GO

CREATE TABLE [dbo].[renlian_token] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [token] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [guoqi] date  NULL,
  [beizhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[renlian_token] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for rzb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[rzb]') AND type IN ('U'))
	DROP TABLE [dbo].[rzb]
GO

CREATE TABLE [dbo].[rzb] (
  [rz_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [rz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_zhongdian] int  NULL,
  [rz_bumen] int  NULL,
  [rz_zhiwu] int  NULL,
  [rz_gangwei] int  NULL,
  [rz_qishiyong] datetime  NULL,
  [rz_zhishiyong] datetime  NULL,
  [rz_shigongzi] int  NULL,
  [rz_zhenggongzi] int  NULL,
  [rz_yongren_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_yongren_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_dianzong_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_dianzong_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_zongzhuguan_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_zongzhuguan_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_zongjian_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_zongjian_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_xingzheng_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_xingzheng_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_dongshizhang_pi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_dongshizhang_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [rz_date] datetime  NULL,
  [rz_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[rzb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for sbsetb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sbsetb]') AND type IN ('U'))
	DROP TABLE [dbo].[sbsetb]
GO

CREATE TABLE [dbo].[sbsetb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [lei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [leiming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qishi] time(7)  NULL,
  [zhishi] time(7)  NULL,
  [fakuan] int  NULL,
  [jifen] int  NULL,
  [shibie] int  NULL,
  [qimiao] int  NULL,
  [zhimiao] int  NULL
)
GO

ALTER TABLE [dbo].[sbsetb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for sbsetb_bumen
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sbsetb_bumen]') AND type IN ('U'))
	DROP TABLE [dbo].[sbsetb_bumen]
GO

CREATE TABLE [dbo].[sbsetb_bumen] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [zubie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gongzuori] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [chidao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sbsetb_bumen] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for sbsetb_teshu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sbsetb_teshu]') AND type IN ('U'))
	DROP TABLE [dbo].[sbsetb_teshu]
GO

CREATE TABLE [dbo].[sbsetb_teshu] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [sb_dian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [sb_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [sb_zhuti] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [sb_qiri] date  NULL,
  [sb_zhiri] date  NULL,
  [sb_sbsj] time(7)  NULL,
  [sb_xbsj] time(7)  NULL,
  [sb_ri] datetime  NULL,
  [sb_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sbsetb_teshu] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for shenpitib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[shenpitib]') AND type IN ('U'))
	DROP TABLE [dbo].[shenpitib]
GO

CREATE TABLE [dbo].[shenpitib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [lei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [shen] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zt] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[shenpitib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for SYS_ROLE
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SYS_ROLE]') AND type IN ('U'))
	DROP TABLE [dbo].[SYS_ROLE]
GO

CREATE TABLE [dbo].[SYS_ROLE] (
  [ROLEID] int  IDENTITY(1,1) NOT NULL,
  [ROLENAME] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [BZ] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [POWER] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[SYS_ROLE] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for sysdiagrams
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sysdiagrams]') AND type IN ('U'))
	DROP TABLE [dbo].[sysdiagrams]
GO

CREATE TABLE [dbo].[sysdiagrams] (
  [name] sysname  NOT NULL,
  [principal_id] int  NOT NULL,
  [diagram_id] int  IDENTITY(1,1) NOT NULL,
  [version] int  NULL,
  [definition] varbinary(max)  NULL
)
GO

ALTER TABLE [dbo].[sysdiagrams] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_audio_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_audio_info]') AND type IN ('U'))
	DROP TABLE [dbo].[T_audio_info]
GO

CREATE TABLE [dbo].[T_audio_info] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [audioId] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [title] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [audioURL] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [newTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [size] bigint  NULL,
  [audioLocalURL] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [description] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [modifyTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [coverURL] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [cateId] bigint  NULL,
  [cateName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] int DEFAULT ((0)) NULL,
  [isShow] int DEFAULT ((0)) NULL,
  [integral] int  NULL,
  [comTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [parts] int  NULL,
  [isAll] int DEFAULT ((0)) NULL,
  [isEnd] int DEFAULT ((0)) NULL,
  [duration] real  NULL,
  [updateShow] varchar(100) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[T_audio_info] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'audioId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频名称',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'title'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频服务地址',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'audioURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频新名',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'newTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频大小',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'size'
GO

EXEC sp_addextendedproperty
'MS_Description', N'本地路径',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'audioLocalURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频描述',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'description'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'modifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频封面图片路径',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'coverURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'cateId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类名称',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'cateName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'2 音频 ',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否上架 0不上架 1 上架',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'isShow'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频积分',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'integral'
GO

EXEC sp_addextendedproperty
'MS_Description', N'音频集合公共名称',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'comTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第几集',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'parts'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否全部人观看 0不是 1是',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'isAll'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否完结 0已完结 1未完结',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'isEnd'
GO

EXEC sp_addextendedproperty
'MS_Description', N'操作上下架的时间',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_info',
'COLUMN', N'updateShow'
GO


-- ----------------------------
-- Table structure for T_audio_time
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_audio_time]') AND type IN ('U'))
	DROP TABLE [dbo].[T_audio_time]
GO

CREATE TABLE [dbo].[T_audio_time] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [audioName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [audioId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [startTime] int  NULL,
  [endTime] int  NULL,
  [userId] int  NOT NULL,
  [isOver] int DEFAULT ((0)) NULL,
  [comTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [currentTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [duration] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_audio_time] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'电影名称',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'audioName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'audioId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看开始时间',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'startTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看结束时间',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'endTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'userId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否观看完  0未观看完  1观看完',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'isOver'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频集合公共名称',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'comTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'退出时播放器的位置',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'currentTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'播放器总时长',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_time',
'COLUMN', N'duration'
GO


-- ----------------------------
-- Table structure for T_audio_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_audio_user]') AND type IN ('U'))
	DROP TABLE [dbo].[T_audio_user]
GO

CREATE TABLE [dbo].[T_audio_user] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [audioId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [userId] int  NOT NULL
)
GO

ALTER TABLE [dbo].[T_audio_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_user',
'COLUMN', N'audioId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_audio_user',
'COLUMN', N'userId'
GO


-- ----------------------------
-- Table structure for T_book_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_book_info]') AND type IN ('U'))
	DROP TABLE [dbo].[T_book_info]
GO

CREATE TABLE [dbo].[T_book_info] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [bookId] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [title] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [bookURL] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [newTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [size] bigint  NULL,
  [bookLocalURL] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [description] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [modifyTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [coverURL] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [cateId] bigint  NULL,
  [cateName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] int DEFAULT ((0)) NULL,
  [isShow] int DEFAULT ((0)) NULL,
  [integral] int DEFAULT ((0)) NULL,
  [comTitle] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [parts] int  NULL,
  [isAll] int DEFAULT ((0)) NULL,
  [isEnd] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_book_info] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'bookId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍名称',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'title'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍服务地址',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'bookURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍新名',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'newTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'电子书大小',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'size'
GO

EXEC sp_addextendedproperty
'MS_Description', N'本地路径',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'bookLocalURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍描述',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'description'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'modifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍封面图片路径',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'coverURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'cateId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类名称',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'cateName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'3 书籍 ',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否上架 0不上架 1 上架',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'isShow'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍积分',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'integral'
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍集合公共名称',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'comTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第几集',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'parts'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否全部人观看 0不是 1是',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'isAll'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否完结 0已完结 1未完结',
'SCHEMA', N'dbo',
'TABLE', N'T_book_info',
'COLUMN', N'isEnd'
GO


-- ----------------------------
-- Table structure for T_book_time
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_book_time]') AND type IN ('U'))
	DROP TABLE [dbo].[T_book_time]
GO

CREATE TABLE [dbo].[T_book_time] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [bookName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [bookId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [startTime] int  NULL,
  [endTime] int  NULL,
  [userId] int  NOT NULL,
  [isOver] int DEFAULT ((0)) NULL,
  [page] int  NULL,
  [sumpage] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_book_time] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'电影名称',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'bookName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'bookId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看开始时间',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'startTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看结束时间',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'endTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'userId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否观看完  0未观看完  1观看完',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'isOver'
GO

EXEC sp_addextendedproperty
'MS_Description', N'页数',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'page'
GO

EXEC sp_addextendedproperty
'MS_Description', N'总页数',
'SCHEMA', N'dbo',
'TABLE', N'T_book_time',
'COLUMN', N'sumpage'
GO


-- ----------------------------
-- Table structure for T_book_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_book_user]') AND type IN ('U'))
	DROP TABLE [dbo].[T_book_user]
GO

CREATE TABLE [dbo].[T_book_user] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [bookId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [userId] int  NOT NULL
)
GO

ALTER TABLE [dbo].[T_book_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'书籍id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_user',
'COLUMN', N'bookId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_book_user',
'COLUMN', N'userId'
GO


-- ----------------------------
-- Table structure for T_check
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_check]') AND type IN ('U'))
	DROP TABLE [dbo].[T_check]
GO

CREATE TABLE [dbo].[T_check] (
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [createrTime] int  NULL,
  [createrUser] int  NOT NULL,
  [checkInfo] varchar(255) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [State] int DEFAULT ((1)) NULL
)
GO

ALTER TABLE [dbo].[T_check] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程id',
'SCHEMA', N'dbo',
'TABLE', N'T_check',
'COLUMN', N'classID'
GO

EXEC sp_addextendedproperty
'MS_Description', N'操作时间',
'SCHEMA', N'dbo',
'TABLE', N'T_check',
'COLUMN', N'createrTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'操作人',
'SCHEMA', N'dbo',
'TABLE', N'T_check',
'COLUMN', N'createrUser'
GO

EXEC sp_addextendedproperty
'MS_Description', N'驳回原因',
'SCHEMA', N'dbo',
'TABLE', N'T_check',
'COLUMN', N'checkInfo'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程计划  1 审核 2 未通过',
'SCHEMA', N'dbo',
'TABLE', N'T_check',
'COLUMN', N'State'
GO


-- ----------------------------
-- Table structure for T_class_evaluate
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_class_evaluate]') AND type IN ('U'))
	DROP TABLE [dbo].[T_class_evaluate]
GO

CREATE TABLE [dbo].[T_class_evaluate] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [classId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [topicA] int  NULL,
  [topicA1] int  NULL,
  [topicA2] int  NULL,
  [topicA3] int  NULL,
  [topicA4] int  NULL,
  [topicB] int  NULL,
  [topicB1] int  NULL,
  [topicB2] int  NULL,
  [topicB3] int  NULL,
  [topicB4] int  NULL,
  [topicC] int  NULL,
  [topicC1] int  NULL,
  [topicC2] int  NULL,
  [topicD] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [topicE] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [topicF] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [topicF1] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [topicF2] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [userID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_class_evaluate] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程Id',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'classId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第一题',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'topicA'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第一题',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'topicA1'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第一题',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'topicA2'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第一题',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'topicA3'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第一题',
'SCHEMA', N'dbo',
'TABLE', N'T_class_evaluate',
'COLUMN', N'topicA4'
GO


-- ----------------------------
-- Table structure for T_class_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_class_info]') AND type IN ('U'))
	DROP TABLE [dbo].[T_class_info]
GO

CREATE TABLE [dbo].[T_class_info] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [classTheme] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classTypeID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classFormID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classManagerID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classSumTime] int  NULL,
  [classStartTime] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classEndTime] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classState] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [teacherName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jstype] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [validate] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pepoleNum] int  NULL,
  [classPhoto] varchar(350) COLLATE Chinese_PRC_CI_AS  NULL,
  [codeUrl] varchar(350) COLLATE Chinese_PRC_CI_AS  NULL,
  [shopName] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [departMent] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yggw] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygzw] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdate] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_class_info] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'培训课程类型',
'SCHEMA', N'dbo',
'TABLE', N'T_class_info',
'COLUMN', N'classTypeID'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0 未开课 1 授课中 2 课程结束  3 课程未按时开课 4 未按时结课',
'SCHEMA', N'dbo',
'TABLE', N'T_class_info',
'COLUMN', N'classState'
GO

EXEC sp_addextendedproperty
'MS_Description', N'关联计划表 id',
'SCHEMA', N'dbo',
'TABLE', N'T_class_info',
'COLUMN', N'filed2'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否有视频 1 有视频',
'SCHEMA', N'dbo',
'TABLE', N'T_class_info',
'COLUMN', N'filed3'
GO


-- ----------------------------
-- Table structure for T_classFormInfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_classFormInfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_classFormInfo]
GO

CREATE TABLE [dbo].[T_classFormInfo] (
  [classFormID] int  IDENTITY(1,1) NOT NULL,
  [classForm] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_classFormInfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_ClassPlan
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_ClassPlan]') AND type IN ('U'))
	DROP TABLE [dbo].[T_ClassPlan]
GO

CREATE TABLE [dbo].[T_ClassPlan] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [className] varchar(200) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [classTeacher] varchar(100) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [shopId] int DEFAULT NULL NULL,
  [departmentId] int DEFAULT NULL NULL,
  [planState] int DEFAULT ((0)) NULL,
  [createrUser] int  NULL,
  [createrTime] int  NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classTypeID] int  NULL,
  [classFormID] int  NULL,
  [classSumTime] int  NULL,
  [planObject] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [validate] int  NULL,
  [type] int DEFAULT ((0)) NULL,
  [classStartTime] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classEndTime] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_ClassPlan] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程主题',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'className'
GO

EXEC sp_addextendedproperty
'MS_Description', N'讲师',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'classTeacher'
GO

EXEC sp_addextendedproperty
'MS_Description', N'中心店面 id',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'shopId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'部门 id',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'departmentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程计划 0 未审核  1 审核 2 未通过',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'planState'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人 员工工号',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'createrUser'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建 时间',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'createrTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'计划使用于对象',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'planObject'
GO

EXEC sp_addextendedproperty
'MS_Description', N'计划类型 0课程',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程开始时间',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'classStartTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程结束时间',
'SCHEMA', N'dbo',
'TABLE', N'T_ClassPlan',
'COLUMN', N'classEndTime'
GO


-- ----------------------------
-- Table structure for t_classTypeInfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[t_classTypeInfo]') AND type IN ('U'))
	DROP TABLE [dbo].[t_classTypeInfo]
GO

CREATE TABLE [dbo].[t_classTypeInfo] (
  [classTypeID] int  IDENTITY(1,1) NOT NULL,
  [classType] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[t_classTypeInfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_fileInfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_fileInfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_fileInfo]
GO

CREATE TABLE [dbo].[T_fileInfo] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classTypeID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classFormID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classFileName] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [newname] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [fileUrl] varchar(300) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_fileInfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_integral_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_integral_info]') AND type IN ('U'))
	DROP TABLE [dbo].[T_integral_info]
GO

CREATE TABLE [dbo].[T_integral_info] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [end] int DEFAULT ((0)) NULL,
  [job] int DEFAULT ((0)) NULL,
  [evaluate] int DEFAULT ((0)) NULL,
  [teacher] int DEFAULT ((0)) NULL,
  [otherId] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] int DEFAULT ((0)) NULL,
  [user] int  NOT NULL,
  [createTime] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [late] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_integral_info] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'结束积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'end'
GO

EXEC sp_addextendedproperty
'MS_Description', N'作业积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'job'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程创建人评价积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'evaluate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'讲师积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'teacher'
GO

EXEC sp_addextendedproperty
'MS_Description', N'对应id 视频类对应分类id   线下课程对应 课程ID',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'otherId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类型  0线下课程 1 视频类 3电子书',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'得分人员工号',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'user'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间 ',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'迟到扣分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_info',
'COLUMN', N'late'
GO


-- ----------------------------
-- Table structure for T_integral_set
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_integral_set]') AND type IN ('U'))
	DROP TABLE [dbo].[T_integral_set]
GO

CREATE TABLE [dbo].[T_integral_set] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [end] int DEFAULT ((0)) NULL,
  [job] int DEFAULT ((0)) NULL,
  [evaluate] int DEFAULT ((0)) NULL,
  [teacher] int DEFAULT ((0)) NULL,
  [otherId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [type] int DEFAULT ((0)) NULL,
  [createUser] int  NOT NULL,
  [late] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_integral_set] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'结束积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'end'
GO

EXEC sp_addextendedproperty
'MS_Description', N'作业积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'job'
GO

EXEC sp_addextendedproperty
'MS_Description', N'课程创建人评价积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'evaluate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'讲师积分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'teacher'
GO

EXEC sp_addextendedproperty
'MS_Description', N'对应id 视频类对应分类id   线下课程对应 课程ID',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'otherId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类型  0线下课程 1 视频类 3电子书',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人 工号',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'createUser'
GO

EXEC sp_addextendedproperty
'MS_Description', N'迟到扣分',
'SCHEMA', N'dbo',
'TABLE', N'T_integral_set',
'COLUMN', N'late'
GO


-- ----------------------------
-- Table structure for T_jobInfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_jobInfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_jobInfo]
GO

CREATE TABLE [dbo].[T_jobInfo] (
  [jobID] int  IDENTITY(1,1) NOT NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classCon] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_jobInfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_Kt_Comment
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_Kt_Comment]') AND type IN ('U'))
	DROP TABLE [dbo].[T_Kt_Comment]
GO

CREATE TABLE [dbo].[T_Kt_Comment] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [content] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] varchar(15) COLLATE Chinese_PRC_CI_AS  NULL,
  [createUser] int  NOT NULL,
  [status] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_Kt_Comment] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'内容',
'SCHEMA', N'dbo',
'TABLE', N'T_Kt_Comment',
'COLUMN', N'content'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'T_Kt_Comment',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人',
'SCHEMA', N'dbo',
'TABLE', N'T_Kt_Comment',
'COLUMN', N'createUser'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0 正常  1删除',
'SCHEMA', N'dbo',
'TABLE', N'T_Kt_Comment',
'COLUMN', N'status'
GO


-- ----------------------------
-- Table structure for T_leave_word
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_leave_word]') AND type IN ('U'))
	DROP TABLE [dbo].[T_leave_word]
GO

CREATE TABLE [dbo].[T_leave_word] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [content] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [userId] int  NOT NULL,
  [status] int DEFAULT ((0)) NULL,
  [type] int  NOT NULL,
  [otherId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [createTime] int  NULL,
  [groupId] int DEFAULT ((0)) NULL,
  [parentId] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_leave_word] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'留言内容',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'content'
GO

EXEC sp_addextendedproperty
'MS_Description', N'留言人工号',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'userId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'留言状态 0 正常  1删除',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'留言类型 0 视频 ',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'关联id',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'otherId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'添加时间',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'组标识',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'groupId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'父级',
'SCHEMA', N'dbo',
'TABLE', N'T_leave_word',
'COLUMN', N'parentId'
GO


-- ----------------------------
-- Table structure for T_loginfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_loginfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_loginfo]
GO

CREATE TABLE [dbo].[T_loginfo] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [emid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [emname] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [logintime] datetime  NULL,
  [createtime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_loginfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_personinfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_personinfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_personinfo]
GO

CREATE TABLE [dbo].[T_personinfo] (
  [personID] int  IDENTITY(1,1) NOT NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [stafftx] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffShopName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffBM] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffGw] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffZw] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffphone] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_personinfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_sign_log
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_sign_log]') AND type IN ('U'))
	DROP TABLE [dbo].[T_sign_log]
GO

CREATE TABLE [dbo].[T_sign_log] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [classId] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [userId] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] int  NULL
)
GO

ALTER TABLE [dbo].[T_sign_log] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_signinfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_signinfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_signinfo]
GO

CREATE TABLE [dbo].[T_signinfo] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [classID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [staffID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [signTime] datetime  NULL,
  [endTime] datetime  NULL,
  [jobstate] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_signinfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_staffJobInfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_staffJobInfo]') AND type IN ('U'))
	DROP TABLE [dbo].[T_staffJobInfo]
GO

CREATE TABLE [dbo].[T_staffJobInfo] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [personID] int  NULL,
  [staffID] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [classID] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [jobCon] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [jobState] varchar(1) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] datetime  NULL,
  [lastUpdateTime] datetime  NULL,
  [filed1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [filed3] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_staffJobInfo] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_tag
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_tag]') AND type IN ('U'))
	DROP TABLE [dbo].[T_tag]
GO

CREATE TABLE [dbo].[T_tag] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [tagState] int DEFAULT ((0)) NULL,
  [tagName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] int  NULL,
  [createUser] int  NULL,
  [tagtype] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[T_tag] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态 0启用 1 禁用 2删除',
'SCHEMA', N'dbo',
'TABLE', N'T_tag',
'COLUMN', N'tagState'
GO

EXEC sp_addextendedproperty
'MS_Description', N'标签名称',
'SCHEMA', N'dbo',
'TABLE', N'T_tag',
'COLUMN', N'tagName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'T_tag',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人',
'SCHEMA', N'dbo',
'TABLE', N'T_tag',
'COLUMN', N'createUser'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类型 0添加人员使用',
'SCHEMA', N'dbo',
'TABLE', N'T_tag',
'COLUMN', N'tagtype'
GO


-- ----------------------------
-- Table structure for T_tag_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_tag_user]') AND type IN ('U'))
	DROP TABLE [dbo].[T_tag_user]
GO

CREATE TABLE [dbo].[T_tag_user] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [tagID] int  NULL,
  [userID] int  NULL
)
GO

ALTER TABLE [dbo].[T_tag_user] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for T_video_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_video_info]') AND type IN ('U'))
	DROP TABLE [dbo].[T_video_info]
GO

CREATE TABLE [dbo].[T_video_info] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [videoId] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [title] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [tags] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [status] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [size] bigint  NULL,
  [duration] real  NULL,
  [description] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [createTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [modifyTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [coverURL] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [cateId] bigint  NULL,
  [cateName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] int DEFAULT ((0)) NULL,
  [isShow] int DEFAULT ((0)) NULL,
  [integral] int  NULL,
  [comTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [parts] int  NULL,
  [isAll] int DEFAULT ((0)) NULL,
  [isEnd] int  NULL,
  [updateShow] varchar(100) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[T_video_info] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'videoId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频名称',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'title'
GO

EXEC sp_addextendedproperty
'MS_Description', N'标签',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'tags'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频大小',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'size'
GO

EXEC sp_addextendedproperty
'MS_Description', N'时长',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'duration'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频描述',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'description'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'createTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'modifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'列表图片路径',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'coverURL'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'cateId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类名称',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'cateName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0 视频 1音频',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否上架 0不上架 1 上架',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'isShow'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频积分',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'integral'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频集合公共名称',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'comTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'第几集',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'parts'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否全部人观看 0不是 1是',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'isAll'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0 完结',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'isEnd'
GO

EXEC sp_addextendedproperty
'MS_Description', N'操作上下架的时间',
'SCHEMA', N'dbo',
'TABLE', N'T_video_info',
'COLUMN', N'updateShow'
GO


-- ----------------------------
-- Table structure for T_video_time
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_video_time]') AND type IN ('U'))
	DROP TABLE [dbo].[T_video_time]
GO

CREATE TABLE [dbo].[T_video_time] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [videoName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [videoId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [startTime] int  NULL,
  [endTime] int  NULL,
  [userId] int  NOT NULL,
  [isOver] int DEFAULT ((0)) NULL,
  [videoTime] int  NULL,
  [comTitle] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [currentTime] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [duration] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[T_video_time] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'电影名称',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'videoName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'videoId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看开始时间',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'startTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'观看结束时间',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'endTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'userId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否观看完  0未观看完  1观看完',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'isOver'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频长度 秒',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'videoTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'视频集合公共名称',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'comTitle'
GO

EXEC sp_addextendedproperty
'MS_Description', N'退出时播放器的位置',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'currentTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'播放器总时长',
'SCHEMA', N'dbo',
'TABLE', N'T_video_time',
'COLUMN', N'duration'
GO


-- ----------------------------
-- Table structure for T_video_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_video_user]') AND type IN ('U'))
	DROP TABLE [dbo].[T_video_user]
GO

CREATE TABLE [dbo].[T_video_user] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [videoId] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [userId] int  NOT NULL
)
GO

ALTER TABLE [dbo].[T_video_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'电影id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_user',
'COLUMN', N'videoId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工id',
'SCHEMA', N'dbo',
'TABLE', N'T_video_user',
'COLUMN', N'userId'
GO


-- ----------------------------
-- Table structure for T_videobook_cate
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[T_videobook_cate]') AND type IN ('U'))
	DROP TABLE [dbo].[T_videobook_cate]
GO

CREATE TABLE [dbo].[T_videobook_cate] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [cateId] bigint  NULL,
  [cateName] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [level] int DEFAULT ((0)) NULL,
  [parentId] bigint  NULL,
  [status] int DEFAULT ((0)) NULL,
  [type] int  NULL,
  [createUser] int  NULL
)
GO

ALTER TABLE [dbo].[T_videobook_cate] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类id',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'cateId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类别名称',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'cateName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'等级 0 一级  1 二级 2三级',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'level'
GO

EXEC sp_addextendedproperty
'MS_Description', N'父类id  -1 一级的父类',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'parentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'0 启用 1 禁用 2 删除',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类别的类型 0 视频类 1 音频类 3 电子书',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'操作人',
'SCHEMA', N'dbo',
'TABLE', N'T_videobook_cate',
'COLUMN', N'createUser'
GO


-- ----------------------------
-- Table structure for txlb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[txlb]') AND type IN ('U'))
	DROP TABLE [dbo].[txlb]
GO

CREATE TABLE [dbo].[txlb] (
  [tx_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [tx_shou1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_shou2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_nei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_wai] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_qq] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_weixin] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tx_email] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[txlb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for wqdkb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[wqdkb]') AND type IN ('U'))
	DROP TABLE [dbo].[wqdkb]
GO

CREATE TABLE [dbo].[wqdkb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [wq_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [wq_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_riqi] datetime  NULL,
  [wq_lei] int  NULL,
  [wq_shangxiaban] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_weizhi1] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_weizhi2] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_sheng] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_shi] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_qu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_lu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_hao] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_kehu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_shiyou] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_jing] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_wei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [wq_baosong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[wqdkb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'一个人一天最多外勤打卡2次，所以主键为：年月日员工编号上下午',
'SCHEMA', N'dbo',
'TABLE', N'wqdkb',
'COLUMN', N'wq_zhu'
GO


-- ----------------------------
-- Table structure for xiabanset
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xiabanset]') AND type IN ('U'))
	DROP TABLE [dbo].[xiabanset]
GO

CREATE TABLE [dbo].[xiabanset] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [riqi] date  NOT NULL,
  [xiabanshijian] time(7)  NULL,
  [yuanyin] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xiabanset] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xinxiqxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xinxiqxb]') AND type IN ('U'))
	DROP TABLE [dbo].[xinxiqxb]
GO

CREATE TABLE [dbo].[xinxiqxb] (
  [qx_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qx_bm1] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [qx_bmfanwei] int  NULL
)
GO

ALTER TABLE [dbo].[xinxiqxb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xinxiqxset
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xinxiqxset]') AND type IN ('U'))
	DROP TABLE [dbo].[xinxiqxset]
GO

CREATE TABLE [dbo].[xinxiqxset] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [q_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [q_zhongdian] int  NULL,
  [q_bumen] int  NULL,
  [q_fzhiwu] int  NULL,
  [q_fygid] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xinxiqxset] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xtfenleib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xtfenleib]') AND type IN ('U'))
	DROP TABLE [dbo].[xtfenleib]
GO

CREATE TABLE [dbo].[xtfenleib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xt_dian] int  NULL,
  [xt_bumen] int  NULL,
  [xt_zhiwu] int  NULL,
  [xt_gangwei] int  NULL,
  [xt_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xt_feizhiwu] int  NULL,
  [xt_feigangwei] int  NULL,
  [xt_feiygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xt_lei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xtfenleib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xx_geyanb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xx_geyanb]') AND type IN ('U'))
	DROP TABLE [dbo].[xx_geyanb]
GO

CREATE TABLE [dbo].[xx_geyanb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [geren] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xx_geyanb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'个人工作信息中显示的格言',
'SCHEMA', N'dbo',
'TABLE', N'xx_geyanb',
'COLUMN', N'geren'
GO


-- ----------------------------
-- Table structure for xxb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xxb]') AND type IN ('U'))
	DROP TABLE [dbo].[xxb]
GO

CREATE TABLE [dbo].[xxb] (
  [xx_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [xx_zhongdian] int  NULL,
  [xx_bumen] int  NULL,
  [xx_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xx_leibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xx_baosongzt] int DEFAULT ((0)) NULL,
  [xx_neirong] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [xx_ri] datetime  NULL,
  [xx_bjren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xx_bsren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xx_shibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xxb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'时间戳',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_zhu'
GO

EXEC sp_addextendedproperty
'MS_Description', N'工作信息类别:日R，周Z，月Y，季J，年N',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_leibie'
GO

EXEC sp_addextendedproperty
'MS_Description', N'报送状态,0未报送,1已报送',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_baosongzt'
GO

EXEC sp_addextendedproperty
'MS_Description', N'工作信息内容',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_neirong'
GO

EXEC sp_addextendedproperty
'MS_Description', N'最后编辑时间',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_ri'
GO

EXEC sp_addextendedproperty
'MS_Description', N'编辑人',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_bjren'
GO

EXEC sp_addextendedproperty
'MS_Description', N'报送人',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_bsren'
GO

EXEC sp_addextendedproperty
'MS_Description', N'日：yyyymmdd，周：yyyy00,月：yyyymm,季度：yyyy0,年度：yyyy',
'SCHEMA', N'dbo',
'TABLE', N'xxb',
'COLUMN', N'xx_shibie'
GO


-- ----------------------------
-- Table structure for xxtjb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xxtjb]') AND type IN ('U'))
	DROP TABLE [dbo].[xxtjb]
GO

CREATE TABLE [dbo].[xxtjb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xxtj_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [xxtj_yue] date  NULL,
  [xxtj_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xxtj_dangyuetian] int  NULL,
  [xxtj_yingbao] int  NULL,
  [xxtj_yibao] int  NULL,
  [xxtj_feitian] int  NULL,
  [xxtj_feitiankou] int  NULL,
  [xxtj_quetian] int  NULL,
  [xxtj_quekou] int  NULL,
  [xxtj_quefa] int  NULL,
  [hekou] int  NULL,
  [xxtj_ri] datetime  NULL,
  [xxtj_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xxtjb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xzdjsetb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xzdjsetb]') AND type IN ('U'))
	DROP TABLE [dbo].[xzdjsetb]
GO

CREATE TABLE [dbo].[xzdjsetb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xzdj] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [djqifen] int  NULL,
  [djzhifen] int  NULL,
  [djshuoming] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[xzdjsetb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xzpjb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xzpjb]') AND type IN ('U'))
	DROP TABLE [dbo].[xzpjb]
GO

CREATE TABLE [dbo].[xzpjb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xz_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [xz_dian] int  NULL,
  [xz_bumen] int  NULL,
  [xz_gangwei] int  NULL,
  [xz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_yuefen] date  NULL,
  [xz_xiangmuid] int  NULL,
  [xz_fen] int  NULL,
  [xz_neirong] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_date] datetime  NULL,
  [xz_pingfen] int DEFAULT ((0)) NULL,
  [xz_pingyu] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_pingren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_pingri] datetime  NULL,
  [xz_shenzt] int DEFAULT ((0)) NULL,
  [xz_shendengji] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_shenren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_shenri] datetime  NULL
)
GO

ALTER TABLE [dbo].[xzpjb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'审核状态',
'SCHEMA', N'dbo',
'TABLE', N'xzpjb',
'COLUMN', N'xz_shenzt'
GO

EXEC sp_addextendedproperty
'MS_Description', N'审核并添加等级',
'SCHEMA', N'dbo',
'TABLE', N'xzpjb',
'COLUMN', N'xz_shendengji'
GO


-- ----------------------------
-- Table structure for xzpmb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xzpmb]') AND type IN ('U'))
	DROP TABLE [dbo].[xzpmb]
GO

CREATE TABLE [dbo].[xzpmb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [pm_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [pm_dian] int  NULL,
  [pm_bumen] int  NULL,
  [pm_gangwei] int  NULL,
  [pm_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_yue] date  NULL,
  [pm_defen] int  NULL,
  [pm_jibie] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [pm_ri] datetime  NULL
)
GO

ALTER TABLE [dbo].[xzpmb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xzrib
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xzrib]') AND type IN ('U'))
	DROP TABLE [dbo].[xzrib]
GO

CREATE TABLE [dbo].[xzrib] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xz_dian] int  NULL,
  [xz_bumen] int  NULL,
  [xz_gangwei] int  NULL,
  [xz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_xiangmuid] int  NULL,
  [xz_xiangmufen] int  NULL,
  [xz_neirong] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_ri] date  NULL,
  [xz_date] datetime  NULL,
  [xz_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[xzrib] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for xzsetb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xzsetb]') AND type IN ('U'))
	DROP TABLE [dbo].[xzsetb]
GO

CREATE TABLE [dbo].[xzsetb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [xz_dian] int  NULL,
  [xz_bumen] int  NULL,
  [xz_gangwei] int  NULL,
  [xz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_xiangmu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_quanzhong] int  NULL,
  [xz_pinggucailiao] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [xz_zt] int DEFAULT ((0)) NULL,
  [xz_ztriqi] datetime  NULL
)
GO

ALTER TABLE [dbo].[xzsetb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ydb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ydb]') AND type IN ('U'))
	DROP TABLE [dbo].[ydb]
GO

CREATE TABLE [dbo].[ydb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [yd_ygid] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ydyy] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [tianbaoTime] datetime  NULL,
  [dc_zhongdian] int  NULL,
  [dc_bumen] int  NULL,
  [dc_zhiwu] int  NULL,
  [dc_gangwei] int  NULL,
  [dc_riqi] datetime  NULL,
  [dc_gognzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_zhongdian] int  NULL,
  [dr_bumen] int  NULL,
  [dr_zhiwu] int  NULL,
  [dr_riqi] datetime  NULL,
  [dr_gangwei] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_gongzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_dmyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_dzqianzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_dzqianziriqi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_zxzjyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_zxzjqianzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dc_zxzjqianziriqi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_dmyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_dzqianzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_dzqianziriqi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_zxzjyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_zxzjqianzi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [dr_zxzjqianziriqi] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [xzzjyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [dongshizhangyijian] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [czr_ygid] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ydb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'调动原因',
'SCHEMA', N'dbo',
'TABLE', N'ydb',
'COLUMN', N'ydyy'
GO


-- ----------------------------
-- Table structure for ygb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygb]') AND type IN ('U'))
	DROP TABLE [dbo].[ygb]
GO

CREATE TABLE [dbo].[ygb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [yg_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [yg_dangid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_sex] int  NULL,
  [yg_zaizhi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shouji] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_zhongdian] int  NULL,
  [yg_bumen] int  NULL,
  [yg_zhiwu] int DEFAULT ((0)) NULL,
  [yg_gangwei] int  NULL,
  [yg_zhiwen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_zaigang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_ruzhidate] datetime  NULL,
  [yg_daogangdate] datetime  NULL,
  [yg_dianmingfou] bit DEFAULT ((1)) NULL,
  [yg_mm] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_dakaduming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_gaidumingdate] datetime  NULL,
  [yg_gaidumingdian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_tou] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_lizhidate] datetime  NULL,
  [yg_gongid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_daok] bit DEFAULT ((0)) NULL,
  [yg_shouji2] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_neixian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_waixian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_qq] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_email] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_chidao] int DEFAULT ((0)) NULL,
  [yg_daiyu] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[ygb] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'员工ID',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'档案编号',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_dangid'
GO

EXEC sp_addextendedproperty
'MS_Description', N'姓名',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_ming'
GO

EXEC sp_addextendedproperty
'MS_Description', N'性别',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_sex'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态：在职、离职、事假、产假',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_zaizhi'
GO

EXEC sp_addextendedproperty
'MS_Description', N'入职时间',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_ruzhidate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'到岗时间，每次调岗后都要更新一下，保存的是最新的到岗时间，不是历史到岗时间，历史到岗时间请参照调岗表',
'SCHEMA', N'dbo',
'TABLE', N'ygb',
'COLUMN', N'yg_daogangdate'
GO


-- ----------------------------
-- Table structure for ygb_jiaoyu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygb_jiaoyu]') AND type IN ('U'))
	DROP TABLE [dbo].[ygb_jiaoyu]
GO

CREATE TABLE [dbo].[ygb_jiaoyu] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [jy_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_qiri] date  NULL,
  [jy_zhiri] date  NULL,
  [jy_xuexiao] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_zhuanye] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_zhiwu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_zhengshu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_zmr] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_zmrdh] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_beizhu] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jy_yueshu] nchar(10) COLLATE Chinese_PRC_CI_AS  NULL,
  [shen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygb_jiaoyu] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygb_jiashu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygb_jiashu]') AND type IN ('U'))
	DROP TABLE [dbo].[ygb_jiashu]
GO

CREATE TABLE [dbo].[ygb_jiashu] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [js_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [js_guanxi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [js_ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [js_danwei] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [js_zhiwu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [js_dianhua] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [shen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygb_jiashu] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygb_jiben
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygb_jiben]') AND type IN ('U'))
	DROP TABLE [dbo].[ygb_jiben]
GO

CREATE TABLE [dbo].[ygb_jiben] (
  [jb_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [jb_yangshengri] date  NULL,
  [jb_yinshengri] date  NULL,
  [jb_guoshengri] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_xuexing] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_xingzuo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_shengao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_tizhong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_jiankang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_jibingshi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_techang] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_aihao] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_shenfen] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_minzu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_mianmao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_jiguan] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_huji] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_zhuzhi] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_zhufang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_hunyu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_jiazhao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_jiazhaodaoqi] date  NULL,
  [jb_huzhao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_tuiwu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_tuiwujunxian] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_tuiwuzhuanye] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_gaoxueli] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_biyeyuanxiao] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_zhuanye] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jb_shuxiang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jbashen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [jbbshen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygb_jiben] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygb_jingli
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygb_jingli]') AND type IN ('U'))
	DROP TABLE [dbo].[ygb_jingli]
GO

CREATE TABLE [dbo].[ygb_jingli] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [gz_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [gz_qiri] date  NULL,
  [gz_zhiri] date  NULL,
  [gz_danwei] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_zhiwu] varchar(150) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_gongzuo] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_lizhiyuanyin] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_zhengmingren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_dianhua] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_pingjia] varchar(250) COLLATE Chinese_PRC_CI_AS  NULL,
  [gz_yueshu] int  NULL,
  [shen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygb_jingli] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygdenglub
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygdenglub]') AND type IN ('U'))
	DROP TABLE [dbo].[ygdenglub]
GO

CREATE TABLE [dbo].[ygdenglub] (
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [date] datetime  NULL,
  [mokuan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygdenglub] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygjbxx
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygjbxx]') AND type IN ('U'))
	DROP TABLE [dbo].[ygjbxx]
GO

CREATE TABLE [dbo].[ygjbxx] (
  [yg_id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [yg_xuexing] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_hujixingzhi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shengri_y] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shengri_n] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shenggao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_tizhong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_hun] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_gongshi] datetime  NULL,
  [yg_minmiao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shenfenzheng] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_jiguan] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_zhuzhi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_shengyu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_zuigaoxueli] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_biyexiao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_biyedate] datetime  NULL,
  [yg_zhuanye] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_rusi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_youxiang] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_xingzuo] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_xingge] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_bingyi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_jiaotong] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_huzhao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yg_ruqudao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygjbxx] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for ygtb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygtb]') AND type IN ('U'))
	DROP TABLE [dbo].[ygtb]
GO

CREATE TABLE [dbo].[ygtb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ygt_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ygt_tiyu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygt_wenyu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygt_it] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygt_jiazhao] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygt_yingyu] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ygt_ziping] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[ygtb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for yjfafenb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[yjfafenb]') AND type IN ('U'))
	DROP TABLE [dbo].[yjfafenb]
GO

CREATE TABLE [dbo].[yjfafenb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [yj_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [yj_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [yj_yugongxiu] int  NULL,
  [yj_daoxiu] int  NULL,
  [yj_jiejia] int  NULL,
  [yj_shijia] int  NULL,
  [yj_yue] date  NULL,
  [yj_ri] datetime  NULL,
  [yj_ren] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[yjfafenb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for zfb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[zfb]') AND type IN ('U'))
	DROP TABLE [dbo].[zfb]
GO

CREATE TABLE [dbo].[zfb] (
  [zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [jine] int  NULL,
  [riqi] datetime  NULL,
  [zflei] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [wxdingdan] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [faid] int  NULL,
  [fajine] int  NULL,
  [faznj] int  NULL
)
GO

ALTER TABLE [dbo].[zfb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for zwb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[zwb]') AND type IN ('U'))
	DROP TABLE [dbo].[zwb]
GO

CREATE TABLE [dbo].[zwb] (
  [id] int  IDENTITY(1,1) NOT NULL,
  [ming] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [jibie] int  NULL
)
GO

ALTER TABLE [dbo].[zwb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for zwkb
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[zwkb]') AND type IN ('U'))
	DROP TABLE [dbo].[zwkb]
GO

CREATE TABLE [dbo].[zwkb] (
  [zw_ygid] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zw_shouzhi] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [zw_zhiwen] varchar(max) COLLATE Chinese_PRC_CI_AS  NULL,
  [zw_zhu] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [zw_sf] int DEFAULT ((0)) NULL
)
GO

ALTER TABLE [dbo].[zwkb] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- View structure for chidaobiaozhun_shi
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[chidaobiaozhun_shi]') AND type IN ('V'))
	DROP VIEW [dbo].[chidaobiaozhun_shi]
GO

CREATE VIEW [dbo].[chidaobiaozhun_shi] AS select distinct zubie,biaozhun=STUFF((select '-'+ltrim(gongzuori+chidao) from sbsetb_bumen where zubie=a.zubie for XML path('')),1,1,'') from sbsetb_bumen a
GO


-- ----------------------------
-- View structure for ygdaixinjia_shi
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygdaixinjia_shi]') AND type IN ('V'))
	DROP VIEW [dbo].[ygdaixinjia_shi]
GO

CREATE VIEW [dbo].[ygdaixinjia_shi] AS SELECT     qj_ygid AS ygid, CONVERT(char(7), qj_qiri, 120) AS nianyue, SUBSTRING(qj_lei, 1, 1) + CAST(SUM(qj_tian) AS varchar(10)) AS xiujia
FROM         dbo.qjb AS a
WHERE     (qj_zt = 1) AND (qj_lei <> '公休') AND (qj_lei <> '倒休') AND (qj_lei <> '事假')
GROUP BY qj_lei, qj_ygid, CONVERT(char(7), qj_qiri, 120)
GO


-- ----------------------------
-- View structure for yggw_shi
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[yggw_shi]') AND type IN ('V'))
	DROP VIEW [dbo].[yggw_shi]
GO

CREATE VIEW [dbo].[yggw_shi] AS SELECT     yg_id AS ygid, yg_ming AS ming,
                          (SELECT     ming
                            FROM          dbo.jigoudiguib
                            WHERE      (id = dbo.ygb.yg_zhongdian)) AS zhong,
                          (SELECT     ming
                            FROM          dbo.jigoudiguib AS jigoudiguib_1
                            WHERE      (id = dbo.ygb.yg_bumen)) AS bumen,
                          (SELECT     ming
                            FROM          dbo.zwb
                            WHERE      (id = dbo.ygb.yg_zhiwu)) AS zhiwu,
                          (SELECT     gw
                            FROM          dbo.gwb AS gwb_1
                            WHERE      (id = dbo.ygb.yg_gangwei)) AS gang
FROM         dbo.ygb
GO


-- ----------------------------
-- View structure for ygxiujia_shi
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ygxiujia_shi]') AND type IN ('V'))
	DROP VIEW [dbo].[ygxiujia_shi]
GO

CREATE VIEW [dbo].[ygxiujia_shi] AS SELECT     qj_ygid AS ygid, CONVERT(char(7), qj_qiri, 120) AS nianyue, qj_lei + CAST(SUM(qj_tian) AS varchar(10)) AS xiujia
FROM         dbo.qjb AS a
WHERE     (qj_zt = 1)
GROUP BY qj_lei, qj_ygid, CONVERT(char(7), qj_qiri, 120)
GO


-- ----------------------------
-- Function structure for getxia
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getxia]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getxia]
GO

CREATE FUNCTION [dbo].[getxia](@shang datetime,@xia datetime)
returns varchar(100)
as
begin
DECLARE @hui varchar(100),@s varchar(8),@x varchar(8)
set @s=CONVERT(varchar(8),@shang,108)
set @x=CONVERT(varchar(8),@xia,108)
if (@x is null)
   begin
      if (@s>='12:00:00')
       begin
        set @hui=@s
       end
      else
        begin
          set @hui='无'
        end
   end
else
  begin
    set @hui=@x
  end 
return @hui
end
GO


-- ----------------------------
-- Function structure for getchidao
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getchidao]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getchidao]
GO

CREATE FUNCTION [dbo].[getchidao]
(
	-- @shang为上班日期时间，@biaozhun为迟到标准
	@shang datetime,@xia datetime,@biaozhun varchar(8),@ygid varchar(4)
)
--返回整型
RETURNS int
AS
BEGIN
	DECLARE @hui int,@bz varchar(8),@s varchar(8),@x varchar(8),@sb varchar(8),@dm int
    --判断上下班时间的
    set @s=CONVERT(varchar(8),@shang,108)
    set @x=CONVERT(varchar(8),@xia,108)
    set @dm=(select am_beizhu from kqbeizhu where kb_zhu=CONVERT(char(8),@shang,112)+@ygid)
    if (@x is null)
       begin
          if (@s>='12:00:00')
           begin
            set @sb=''
           end
          else
            begin
              set @sb=@s
            end
       end
    else
       begin
         set @sb=@s
       end 
    --判断上下班时间的
    
     if (@biaozhun='')
        begin
          set @bz='08:30:00'
        end
     else
        begin
         set @bz=@biaozhun
        end

if(@sb<>'')
   begin
     if(@sb>@bz and @sb<'09:00:00')
       begin
         set @hui=1
       end
    else
       begin
          if(@sb>'14:00:00')
            begin
              set @hui=1
            end
          else
             begin
               set @hui=0
             end
       end
   end
else
   begin
      set @hui=0
   end

if(@hui=1)
  begin
    if(@dm=6)/**6是外出*/
      begin
        set @hui=0
      end
  end
      
return @hui

END
GO


-- ----------------------------
-- Function structure for bh_getdays
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[bh_getdays]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[bh_getdays]
GO

CREATE FUNCTION [dbo].[bh_getdays]
(	
	@nianyue varchar(7)
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT convert(varchar(10),DATEADD(day,number,@nianyue+'-01'),120) AS days,convert(varchar(10),DATEADD(day,number,@nianyue+'-01'),112) as dy  FROM master..spt_values WHERE TYPE = 'P' AND DATEADD(DAY,number,@nianyue+'-01') <= DATEADD(Day,-1,CONVERT(char(8),DATEADD(Month,1,@nianyue+'-01'),120)+'1')
)
GO


-- ----------------------------
-- Procedure structure for sp_helpdiagramdefinition
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_helpdiagramdefinition]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_helpdiagramdefinition]
GO

CREATE PROCEDURE [dbo].[sp_helpdiagramdefinition]
	(
		@diagramname 	sysname,
		@owner_id	int	= null 		
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		set nocount on

		declare @theId 		int
		declare @IsDbo 		int
		declare @DiagId		int
		declare @UIDFound	int
	
		if(@diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner');
		if(@owner_id is null)
			select @owner_id = @theId;
		revert; 
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname;
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId ))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end

		select version, definition FROM dbo.sysdiagrams where diagram_id = @DiagId ; 
		return 0
	END
GO


-- ----------------------------
-- Function structure for getzaodaofenzhong
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getzaodaofenzhong]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getzaodaofenzhong]
GO

CREATE FUNCTION [dbo].[getzaodaofenzhong]
(
	-- 上班时间
	@shang datetime
)
RETURNS int --返回整数型,加班分钟数
AS
BEGIN
	-- 创建变量
	DECLARE @hui int,@s varchar(8)
	set @s=CONVERT(varchar(8),@shang,108)--上班时间

	if(@s<'08:30:00')
	set @hui=DATEDIFF(mi,@s,'08:30:00')
    else
     set @hui=0
	-- 返回早到分钟数
	RETURN @hui

END
GO


-- ----------------------------
-- Procedure structure for sp_dropdiagram
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_dropdiagram]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_dropdiagram]
GO

CREATE PROCEDURE [dbo].[sp_dropdiagram]
	(
		@diagramname 	sysname,
		@owner_id	int	= null
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT; 
		
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		delete from dbo.sysdiagrams where diagram_id = @DiagId;
	
		return 0;
	END
GO


-- ----------------------------
-- Procedure structure for weigui_p
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[weigui_p]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[weigui_p]
GO

CREATE PROCEDURE [dbo].[weigui_p]
(
--传递的参数
@kaishiData char(10),@jieshuData char(10)

)
as
--定义变量，@xx表示局部变量，@@xx表示全局变量。定义多个变量用","号分割   
declare @i int
declare  @shangbantiem char(10)--上班时间
declare  @xiabantiem   char(10)--下班时间
declare  @xiabant char(10)--下班打卡时间
set @shangbantiem='08:30:00'
set @xiabant='18:00:00'
--if(select DATENAME(weekday, k_sri) as xingqi from kqb1)
  
 select convert(char(10),k_sri,120) as 日期,DATENAME(weekday, k_sri) as 星期,k_ygid as 编号,
(select yg_ming from ygb where yg_id=k_ygid) as 姓名,convert(char(8),k_sri,108) as 上班打卡,
(case when k_sdadi =2 then '总部' else (select ming from jigoudiguib where id=k_sdadi)end) as 上班打卡地,
convert(char(8),k_xri,108) as 下班打卡,
(case when k_xdadi=2 then '总部'else(select ming from jigoudiguib where id=k_xdadi)end) as 下班打卡地,
cast(floor(DATEDIFF(hh,k_sri,k_xri)) as varchar)+'时'+cast(floor((DATEDIFF(s,k_sri,k_xri)/60)%60)as varchar)+'分' as 工作时长,
k_shudi,(select ming from jigoudiguib where id=k_shudi)as 所属部门 from kqb1
 where convert(varchar(100),k_sri,23) between @kaishiData and @jieshuData 
 and  convert(char(8),k_xri,108)<@xiabant 
----and  convert(char(8),k_sri,108)>@shangbantiem
GO


-- ----------------------------
-- Procedure structure for sp_helpdiagrams
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_helpdiagrams]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_helpdiagrams]
GO

CREATE PROCEDURE [dbo].[sp_helpdiagrams]
	(
		@diagramname sysname = NULL,
		@owner_id int = NULL
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		DECLARE @user sysname
		DECLARE @dboLogin bit
		EXECUTE AS CALLER;
			SET @user = USER_NAME();
			SET @dboLogin = CONVERT(bit,IS_MEMBER('db_owner'));
		REVERT;
		SELECT
			[Database] = DB_NAME(),
			[Name] = name,
			[ID] = diagram_id,
			[Owner] = USER_NAME(principal_id),
			[OwnerID] = principal_id
		FROM
			sysdiagrams
		WHERE
			(@dboLogin = 1 OR USER_NAME(principal_id) = @user) AND
			(@diagramname IS NULL OR name = @diagramname) AND
			(@owner_id IS NULL OR principal_id = @owner_id)
		ORDER BY
			4, 5, 1
	END
GO


-- ----------------------------
-- Procedure structure for ydb_dele
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ydb_dele]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[ydb_dele]
GO

CREATE PROCEDURE [dbo].[ydb_dele]
(
	@id INT, ----主键id
	@yg_id NVARCHAR(50),
	@yg_zhongdian INT,
	@yg_bumen INT,
	@yg_zhiwu INT,
	@yg_gangwei INT
)
AS
	begin
       set xact_abort on; --将set xact_abort on，然后在catch中判断xact_state()的值来判断是否需要Rollback操作。
       begin try
           begin tran
              delete from ydb where id=@id;
              update ygb set yg_zhongdian=@yg_zhongdian,yg_bumen=@yg_bumen,yg_zhiwu=@yg_zhiwu,yg_gangwei=@yg_gangwei  where yg_id=@yg_id;
           commit tran
       end try
       begin catch
           --在此可以使用xact_state()来判断是否有不可提交的事务,不可提交的事务
           --表示在事务内部发生错误了。Xact_state()有三种值：-1.事务不可提交；
           --1.事务可提交；0.表示没有事务，此时commit或者rollback会报错。
           if xact_state()=-1
              rollback tran;
       end catch
end

-----------------------存储过程中使用事务,删除异动记录，然后修改员工表中心店面，部门，岗位，职务----------------------------------------------
GO


-- ----------------------------
-- Procedure structure for sp_alterdiagram
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_alterdiagram]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_alterdiagram]
GO

CREATE PROCEDURE [dbo].[sp_alterdiagram]
	(
		@diagramname 	sysname,
		@owner_id	int	= null,
		@version 	int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId 			int
		declare @retval 		int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @ShouldChangeUID	int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid ARG', 16, 1)
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();	 
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		revert;
	
		select @ShouldChangeUID = 0
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		
		if(@DiagId IS NULL or (@IsDbo = 0 and @theId <> @UIDFound))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end
	
		if(@IsDbo <> 0)
		begin
			if(@UIDFound is null or USER_NAME(@UIDFound) is null) -- invalid principal_id
			begin
				select @ShouldChangeUID = 1 ;
			end
		end

		-- update dds data			
		update dbo.sysdiagrams set definition = @definition where diagram_id = @DiagId ;

		-- change owner
		if(@ShouldChangeUID = 1)
			update dbo.sysdiagrams set principal_id = @theId where diagram_id = @DiagId ;

		-- update dds version
		if(@version is not null)
			update dbo.sysdiagrams set version = @version where diagram_id = @DiagId ;

		return 0
	END
GO


-- ----------------------------
-- Procedure structure for sp_upgraddiagrams
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_upgraddiagrams]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_upgraddiagrams]
GO

CREATE PROCEDURE [dbo].[sp_upgraddiagrams]
	AS
	BEGIN
		IF OBJECT_ID(N'dbo.sysdiagrams') IS NOT NULL
			return 0;
	
		CREATE TABLE dbo.sysdiagrams
		(
			name sysname NOT NULL,
			principal_id int NOT NULL,	-- we may change it to varbinary(85)
			diagram_id int PRIMARY KEY IDENTITY,
			version int,
	
			definition varbinary(max)
			CONSTRAINT UK_principal_name UNIQUE
			(
				principal_id,
				name
			)
		);


		/* Add this if we need to have some form of extended properties for diagrams */
		/*
		IF OBJECT_ID(N'dbo.sysdiagram_properties') IS NULL
		BEGIN
			CREATE TABLE dbo.sysdiagram_properties
			(
				diagram_id int,
				name sysname,
				value varbinary(max) NOT NULL
			)
		END
		*/

		IF OBJECT_ID(N'dbo.dtproperties') IS NOT NULL
		begin
			insert into dbo.sysdiagrams
			(
				[name],
				[principal_id],
				[version],
				[definition]
			)
			select	 
				convert(sysname, dgnm.[uvalue]),
				DATABASE_PRINCIPAL_ID(N'dbo'),			-- will change to the sid of sa
				0,							-- zero for old format, dgdef.[version],
				dgdef.[lvalue]
			from dbo.[dtproperties] dgnm
				inner join dbo.[dtproperties] dggd on dggd.[property] = 'DtgSchemaGUID' and dggd.[objectid] = dgnm.[objectid]	
				inner join dbo.[dtproperties] dgdef on dgdef.[property] = 'DtgSchemaDATA' and dgdef.[objectid] = dgnm.[objectid]
				
			where dgnm.[property] = 'DtgSchemaNAME' and dggd.[uvalue] like N'_EA3E6268-D998-11CE-9454-00AA00A3F36E_' 
			return 2;
		end
		return 1;
	END
GO


-- ----------------------------
-- Function structure for xz_sum_fenshu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[xz_sum_fenshu]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[xz_sum_fenshu]
GO

CREATE FUNCTION [dbo].[xz_sum_fenshu]
(
	@ygid varchar(10),@nianyue varchar(7)
)
RETURNS varchar(10)
AS
BEGIN
	-- Declare the return variable here
	DECLARE @hui varchar(10),@yid varchar(10),@ny varchar(7),@hefen int 
    set @yid=@ygid
    set @ny=@nianyue
    set @hefen=(select SUM(xz_pingfen) from xzpjb where xz_ygid=@yid and convert(char(7),xz_yuefen,120)=@ny and xz_xiangmuid in (select id from xzsetb where xz_zt=0))
    set @hui=(select xzdj from xzdjsetb where @hefen between djqifen and djzhifen)
    
	RETURN @hui

END
GO


-- ----------------------------
-- Function structure for getxxtianshu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getxxtianshu]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getxxtianshu]
GO

CREATE FUNCTION [dbo].[getxxtianshu]
(
	@ruzhi varchar(10),@dangqian varchar(10),@dangqiantianshu int
)
RETURNS int
AS
BEGIN
	
	DECLARE @hui int,@r varchar(7),@d varchar(7)
	set @r=CONVERT(varchar(7),@ruzhi,120)
	set @d=CONVERT(varchar(7),@dangqian,120)
	
	 if (@r<@d)
       begin
         set @hui=@dangqiantianshu
       end
    else
      if (@r=@d)
       begin
         set @hui=(@dangqiantianshu-DAY(@ruzhi))
       end 
      else
       begin
         set @hui=0
       end 

	
return @hui
END
GO


-- ----------------------------
-- Function structure for getshang
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getshang]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getshang]
GO

CREATE FUNCTION [dbo].[getshang](@shang datetime,@xia datetime)
returns varchar(100)
as
begin
DECLARE @hui varchar(100),@s varchar(8),@x varchar(8)
set @s=CONVERT(varchar(8),@shang,108)
set @x=CONVERT(varchar(8),@xia,108)
if (@x is null)
   begin
      if (@s>='12:00:00')
       begin
        set @hui='无'
       end
      else
        begin
          set @hui=@s
        end
   end
else
  begin
    set @hui=@s
  end 
return @hui
end
GO


-- ----------------------------
-- Procedure structure for sp_renamediagram
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_renamediagram]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_renamediagram]
GO

CREATE PROCEDURE [dbo].[sp_renamediagram]
	(
		@diagramname 		sysname,
		@owner_id		int	= null,
		@new_diagramname	sysname
	
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @DiagIdTarg		int
		declare @u_name			sysname
		if((@diagramname is null) or (@new_diagramname is null))
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT;
	
		select @u_name = USER_NAME(@owner_id)
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		-- if((@u_name is not null) and (@new_diagramname = @diagramname))	-- nothing will change
		--	return 0;
	
		if(@u_name is null)
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @new_diagramname
		else
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @owner_id and name = @new_diagramname
	
		if((@DiagIdTarg is not null) and  @DiagId <> @DiagIdTarg)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end		
	
		if(@u_name is null)
			update dbo.sysdiagrams set [name] = @new_diagramname, principal_id = @theId where diagram_id = @DiagId
		else
			update dbo.sysdiagrams set [name] = @new_diagramname where diagram_id = @DiagId
		return 0
	END
GO


-- ----------------------------
-- Function structure for miaototime
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[miaototime]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[miaototime]
GO

CREATE FUNCTION [dbo].[miaototime]
(
	@miao int
)
RETURNS varchar(8)
AS
BEGIN
	-- Declare the return variable here
	DECLARE @hui varchar(8)

	set @hui=CONVERT(VARCHAR(8),CONVERT(TIME,DATEADD(ss,@miao,'1900-01-01'))) 

	-- Return the result of the function
	RETURN @hui

END
GO


-- ----------------------------
-- Function structure for gettianshu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[gettianshu]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[gettianshu]
GO

CREATE FUNCTION [dbo].[gettianshu]
(
	@ny varchar(7)--年月
)
RETURNS int
AS
BEGIN
DECLARE @hui int,@s varchar(10)
    set @s=@ny+'-01'
   
	set @hui=32-DAY(cast(@s as datetime)+32-DAY(cast(@s as datetime)))

return @hui

END
GO


-- ----------------------------
-- Function structure for getchuqin
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getchuqin]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getchuqin]
GO

CREATE FUNCTION [dbo].[getchuqin]
(
	@shang datetime,@xia datetime
)
RETURNS decimal(3,1)--返回值是带1位小数的
AS
BEGIN
	DECLARE @hui decimal(3,1),@s varchar(8),@x varchar(8),@xx varchar(10),@yueri varchar(5),@zhouji int,@teshu varchar(8)
    set @s=CONVERT(varchar(8),@shang,108)
    set @x=CONVERT(varchar(8),@xia,108)
    set @xx=CONVERT(varchar(10),@xia,120)--年月日
    set @yueri=convert(char(5),@xia,110)--月日
    set @zhouji=datepart(weekday,CONVERT(varchar(10),@xia,120))--周几，周一：2，周五：6，周六：7，周日：1
    select @teshu=left(xiabanshijian,8) from xiabanset where riqi=@xx
    --set @teshu='2018-03-02 16:00:00'
    
if (@x is null)
begin
     set @hui=0.5--缺一次打卡半天
     return @hui
end
else
begin
    if(@s<='09:00:00')
      begin 
        if (@x>='12:00:00')
            begin
            --特殊下班时间
            if(@teshu<>'')
             begin
             if(@x>=@teshu)
             begin
             set @hui=1
             return @hui
             end
             else
             begin
             set @hui=0.5
             return @hui
             end
             end
            --特殊下班时间
               if(@yueri>='05-01' and @yueri<='09-30')--夏季
                begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五
                    if(@x>='18:00:00')
                    set @hui=1
                    else
                    set @hui=0.5
                  else--周六日
                    if(@x>='18:30:00')
                    set @hui=1
                    else
                    set @hui=0.5
                end
               else--冬季，10月1日至4月30日
               begin
                if(@yueri>='10-08')
                begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五
                    if(@x>='17:30:00')
                    set @hui=1
                    else
                    set @hui=0.5
                  else--周六日
                    if(@x>='18:00:00')
                    set @hui=1
                    else
                    set @hui=0.5
                 end
                 if(@yueri<='04-30')
                begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五
                    if(@x>='17:30:00')
                    set @hui=1
                    else
                    set @hui=0.5
                  else--周六日
                    if(@x>='18:00:00')
                    set @hui=1
                    else
                    set @hui=0.5
                 end
                 if(@yueri>='10-01' and @yueri<='10-07')
                begin
                    if(@x>='18:30:00')
                    set @hui=1
                    else
                    set @hui=0.5
                 end
                end
            end 
         else
          set @hui=0.5--12点之前打卡算半天
      end
      else
      begin
         set @hui=0.5--9点以后打卡算半天
      end
end
 
return @hui

--使用说明，if必须有处理语句，如果只有一句，也可以不使用begin..end,只包含后面一句
END
GO


-- ----------------------------
-- Procedure structure for kqripm
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kqripm]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[kqripm]
GO

CREATE PROCEDURE [dbo].[kqripm]
	-- Add the parameters for the stored procedure here
	(@ri varchar(10),@yid varchar(4),@sx varchar(2))
	
AS

BEGIN
    -- 创建变量
	DECLARE @hui varchar(1000),
	        @dian varchar(100),
	        @sxb varchar(2),
	        @dao varchar(8),
	        @jindianmc varchar(100),
	        @jingsmc varchar(100),
	        @lei varchar(100),
	        @leidianmc varchar(100),
	        @leigsmc varchar(100),
	        @gei varchar(200)
	set @sxb=@sx
	
	--获取员工所属店面
	set @dian=(select shibie from jigoudiguib where id=(select yg_zhongdian from ygb where yg_id=@yid))
	--本月累计店排名
	set @gei=(select convert(varchar(100),mc)+','+convert(varchar(100),leiji)+','+convert(varchar(100),isnull(tm,'无')) from (SELECT row_number()over(ORDER BY sum(pm_fenzhong) desc)AS mc,pm_ygid as yid,sum(pm_fenzhong) as leiji,max(pm_dkri) as zuihou,(select LEFT(pm_dktime,8) from kqpmb b where b.pm_ygid=a.pm_ygid and CONVERT(char(10),pm_dkri,120)=@ri and pm_sborxb=@sxb) as tm FROM kqpmb a where convert(char(7),pm_dkri,120)=CONVERT(char(7),@ri,120) and pm_sborxb=@sxb and convert(char(10),pm_dkri,120)<=@ri and pm_shibie=@dian group by pm_ygid) as u where u.yid=@yid)
	set @leidianmc=dbo.mysqlit(@gei,',',1)
	set @lei=dbo.mysqlit(@gei,',',2)
	set @dao=dbo.mysqlit(@gei,',',3)
	
	--本月累计公司排名
	set @leigsmc=(select mc from (SELECT row_number()over(ORDER BY sum(pm_fenzhong) desc)AS mc,pm_ygid as yid,sum(pm_fenzhong) as leiji,max(pm_dkri) as zuihou,(select LEFT(pm_dktime,8) from kqpmb b where b.pm_ygid=a.pm_ygid and CONVERT(char(10),pm_dkri,120)=@ri and pm_sborxb=@sxb) as tm FROM kqpmb a where convert(char(7),pm_dkri,120)=CONVERT(char(7),@ri,120) and pm_sborxb=@sxb and convert(char(10),pm_dkri,120)<=@ri group by pm_ygid) as u where u.yid=@yid)
	
	--当日店排名
	set @jindianmc=isnull((select mc from (select row_number()over(ORDER BY pm_dktime)AS mc,LEFT(pm_dktime,8) as tm,pm_ygid as yid from kqpmb where convert(char(10),pm_dkri,120)=@ri and pm_sborxb=@sxb and pm_shibie=@dian) as u where u.yid =@yid),0)
	
	--当日公司排名
	set @jingsmc=isnull((select mc from (select row_number()over(ORDER BY pm_dktime)AS mc,LEFT(pm_dktime,8) as tm,pm_ygid as yid from kqpmb where convert(char(10),pm_dkri,120)=@ri and pm_sborxb=@sxb) as u where u.yid =@yid),0)
	
	set @hui=@dao+','+@jindianmc+','+@jingsmc+','+@lei+','+@leidianmc+','+@leigsmc

    select @hui
END
GO


-- ----------------------------
-- Procedure structure for ydb_Pager
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ydb_Pager]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[ydb_Pager]
GO

CREATE PROCEDURE [dbo].[ydb_Pager]
	@PageSize INT, ----每页记录数
	@CurrentCount INT, ----当前记录数量（页码*每页记录数）
	@TableName NVARCHAR(200), ----表名称
	@Where NVARCHAR(800), ----查询条件
	@Order NVARCHAR(800),----排序条件
	@TotalCount INT OUTPUT ----记录总数
AS
	DECLARE @sqlSelect    NVARCHAR(2000) ----局部变量（sql语句），查询记录集
	DECLARE @sqlGetCount  NVARCHAR(2000) ----局部变量（sql语句），取出记录集总数
	
	
	SET @sqlSelect = 'SELECT  id,yd_ygid,dc_zhongdian,dc_bumen,dc_zhiwu,dc_gangwei,(select yg_ming from ygb where yg_id=yd_ygid)as ygming,dr_riqi,(select ming from jigoudiguib where id=dc_zhongdian)as qzxdm,(select ming from jigoudiguib where id=dc_bumen)as qbumen,(select  ming from zwb where zwb.id=dc_zhiwu)as qzhiwu,(select  gwb.gw from gwb where gwb.id=dc_gangwei)as qgangwei,(select ming from jigoudiguib where id=dr_zhongdian)as hzxdm,(select ming from jigoudiguib where id=dr_bumen)as hbumen,(select  ming from zwb where zwb.id=dr_zhiwu)as hzhiwu,(select  gwb.gw from gwb where gwb.id=dr_gangwei)as hgangwei FROM  ' 
	    + '    (SELECT ROW_NUMBER()  OVER( ORDER BY ' + @Order +
	    ' ) AS RowNumber,* '
	    + '        FROM ' + @TableName 
	    + '        WHERE ' + @Where 
	    + '     ) as  T2 ' 
	    + ' WHERE T2.RowNumber<= ' + STR(@CurrentCount + @PageSize) +
	    ' AND T2.RowNumber>' + STR(@CurrentCount) 
	
	SET @sqlGetCount = 'SELECT @TotalCount = COUNT(*) FROM ' + @TableName 
	    + ' WHERE ' + @Where
	
	
	EXEC (@sqlSelect) 
	EXEC SP_EXECUTESQL @sqlGetCount,
	     N'@TotalCount INT OUTPUT',
	     @TotalCount OUTPUT
GO


-- ----------------------------
-- Function structure for getjiaban
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getjiaban]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getjiaban]
GO

CREATE FUNCTION [dbo].[getjiaban]
(
	-- 参数上班时间和下班时间
	@shang datetime,@xia datetime
)
RETURNS int --返回整数型,加班分钟数
AS
BEGIN
	-- 创建变量
	DECLARE @hui int,@s varchar(8),@x varchar(8),@xx varchar(10),@yueri varchar(5),@zhouji int,@teshu varchar(8),@qu varchar(8)
    set @s=CONVERT(varchar(8),@shang,108)--上班时间
    set @x=CONVERT(varchar(8),@xia,108)--下班时间
    set @xx=CONVERT(varchar(10),@shang,120)--上下班的年月日
    set @yueri=convert(char(5),@shang,110)--月日
    set @zhouji=datepart(weekday,CONVERT(varchar(10),@shang,120))--周几，周一：2，周五：6，周六：7，周日：1
    select @teshu=left(xiabanshijian,8) from xiabanset where riqi=@xx --特殊的下班时间
    
    --第一步取哪个时间用来计算，如果下班时间没有，就取上班时间
    if(@x is null)
     set @qu=@s
    else
     set @qu=@x
     
    --第二步计算
     if(@teshu<>'')--今日有特殊下班规定
	    begin
	     set @hui=DATEDIFF(mi,@teshu,@qu)
	    end
	   else--没有特殊下班时间，需要复杂计算
	    begin
	      if(@yueri>='05-01' and @yueri<='09-30')--夏季
	        begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五 
                    set @hui=DATEDIFF(mi,'18:00:00',@qu)
                  else--周六日
                    set @hui=DATEDIFF(mi,'18:30:00',@qu)
            end
          else--冬季，10月1日至4月30日
            begin
              if(@yueri>='10-08')
                begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五
                   set @hui=DATEDIFF(mi,'17:30:00',@qu)
                  else--周六日
                   set @hui=DATEDIFF(mi,'18:00:00',@qu)
                 end
              if(@yueri<='04-30')
                begin
                  if(@zhouji>=2 and @zhouji<=6)--周一到周五
                   set @hui=DATEDIFF(mi,'17:30:00',@qu)
                  else--周六日
                   set @hui=DATEDIFF(mi,'18:00:00',@qu)
                 end  
              if(@yueri>='10-01' and @yueri<='10-07')
                set @hui=DATEDIFF(mi,'18:30:00',@qu)
            end     
	    end
	    
	
   --第三步返回前判断
   if(@hui<0)--小于零属于早退,返回加班分钟数0
    set @hui=0
  
    
return @hui

END
GO


-- ----------------------------
-- Function structure for fn_diagramobjects
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[fn_diagramobjects]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[fn_diagramobjects]
GO

CREATE FUNCTION [dbo].[fn_diagramobjects]() 
	RETURNS int
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		declare @id_upgraddiagrams		int
		declare @id_sysdiagrams			int
		declare @id_helpdiagrams		int
		declare @id_helpdiagramdefinition	int
		declare @id_creatediagram	int
		declare @id_renamediagram	int
		declare @id_alterdiagram 	int 
		declare @id_dropdiagram		int
		declare @InstalledObjects	int

		select @InstalledObjects = 0

		select 	@id_upgraddiagrams = object_id(N'dbo.sp_upgraddiagrams'),
			@id_sysdiagrams = object_id(N'dbo.sysdiagrams'),
			@id_helpdiagrams = object_id(N'dbo.sp_helpdiagrams'),
			@id_helpdiagramdefinition = object_id(N'dbo.sp_helpdiagramdefinition'),
			@id_creatediagram = object_id(N'dbo.sp_creatediagram'),
			@id_renamediagram = object_id(N'dbo.sp_renamediagram'),
			@id_alterdiagram = object_id(N'dbo.sp_alterdiagram'), 
			@id_dropdiagram = object_id(N'dbo.sp_dropdiagram')

		if @id_upgraddiagrams is not null
			select @InstalledObjects = @InstalledObjects + 1
		if @id_sysdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 2
		if @id_helpdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 4
		if @id_helpdiagramdefinition is not null
			select @InstalledObjects = @InstalledObjects + 8
		if @id_creatediagram is not null
			select @InstalledObjects = @InstalledObjects + 16
		if @id_renamediagram is not null
			select @InstalledObjects = @InstalledObjects + 32
		if @id_alterdiagram  is not null
			select @InstalledObjects = @InstalledObjects + 64
		if @id_dropdiagram is not null
			select @InstalledObjects = @InstalledObjects + 128
		
		return @InstalledObjects 
	END
GO


-- ----------------------------
-- Function structure for bh_getqizhitian
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[bh_getqizhitian]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[bh_getqizhitian]
GO

CREATE FUNCTION [dbo].[bh_getqizhitian]
(	
	-- Add the parameters for the function here
	@qiri varchar(10),@zhiri varchar(10)
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT convert(varchar(10),DATEADD(day,number,@qiri),120) AS days,convert(varchar(10),DATEADD(day,number,@qiri),112) as dy  FROM master..spt_values WHERE TYPE = 'P' AND DATEADD(DAY,number,@qiri) <= @zhiri
)
GO


-- ----------------------------
-- Function structure for getmiao
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[getmiao]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[getmiao]
GO

CREATE FUNCTION [dbo].[getmiao]
(
	@shi datetime
)
RETURNS int
AS
BEGIN
	DECLARE @hui int,@s int

	set @s=cast(datename(Hour,@shi) as int)*3600
    set @s+=cast(datename(Minute,@shi) as int)*60
    set @s+=cast(datename(Second,@shi) as int)

	set @hui=@s
	RETURN @hui

END
GO


-- ----------------------------
-- Function structure for mysqlit
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[mysqlit]') AND type IN ('FN', 'FS', 'FT', 'IF', 'TF'))
	DROP FUNCTION[dbo].[mysqlit]
GO

CREATE FUNCTION [dbo].[mysqlit] 
(
	@List nvarchar(2000),--要分隔的字符串
    @SplitOn nvarchar(5),--分隔符
    @num1 int
)
RETURNS varchar(50)
AS
BEGIN
	declare @i int,
		@j int,
		@p int,
		@num int,
		@aa Varchar(200)

	Set @i=0
	Set @j=len(@SplitOn)
	Set @p=0 
	While LEN(@List) > 0
	Begin
		Set @p = CHARINDEX(@SplitOn,@List)
		if @p > 0
		begin
			set @aa = SUBSTRING(@List,1,@p - 1)
			set @List= SUBSTRING(@List,@p + @j, LEN(@List))
		end
		else
		begin
			set @aa = @List
			set @List= ''
		end
		set @i = @i + 1
		
		If @i=@num1
		Begin
			break
		End	
		else
			set @aa= ''
		
	End
return @aa	

END
GO


-- ----------------------------
-- Procedure structure for sp_creatediagram
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_creatediagram]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[sp_creatediagram]
GO

CREATE PROCEDURE [dbo].[sp_creatediagram]
	(
		@diagramname 	sysname,
		@owner_id		int	= null, 	
		@version 		int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId int
		declare @retval int
		declare @IsDbo	int
		declare @userName sysname
		if(@version is null or @diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID(); 
		select @IsDbo = IS_MEMBER(N'db_owner');
		revert; 
		
		if @owner_id is null
		begin
			select @owner_id = @theId;
		end
		else
		begin
			if @theId <> @owner_id
			begin
				if @IsDbo = 0
				begin
					RAISERROR (N'E_INVALIDARG', 16, 1);
					return -1
				end
				select @theId = @owner_id
			end
		end
		-- next 2 line only for test, will be removed after define name unique
		if EXISTS(select diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @diagramname)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end
	
		insert into dbo.sysdiagrams(name, principal_id , version, definition)
				VALUES(@diagramname, @theId, @version, @definition) ;
		
		select @retval = @@IDENTITY 
		return @retval
	END
GO


-- ----------------------------
-- Procedure structure for kq_grmr
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[kq_grmr]') AND type IN ('P', 'PC', 'RF', 'X'))
	DROP PROCEDURE[dbo].[kq_grmr]
GO

CREATE PROCEDURE [dbo].[kq_grmr] 
	-- Add the parameters for the stored procedure here
	@nianyue varchar(7),@dian varchar(10),@bumen varchar(10)
AS
declare @sql varchar(8000)
SET @sql = 'SELECT yg_id as 员工编号,yg_ming as 姓名'
select @sql=@sql+',(select cast(CONVERT(char(5),dbo.getshang(k_sri,k_xri),108) as varchar(8))+''/''+cast(CONVERT(char(5),dbo.getxia(k_sri,k_xri),108) as varchar(8)) from kqb1 where k_ygid=yg_id and LEFT(k_zhu,8)=''' + 给日 + ''') as [' + 日 + '日]' 
from (
select convert(char(2),dateadd(dd,number,@nianyue+'-01'),103) AS 日,convert(char(8),dateadd(dd,number,@nianyue+'-01'),112) as 给日
 from master..spt_values  
 where type='p' and convert(char(7),dateadd(dd,number,@nianyue+'-01'),120)=@nianyue
) as b 
set @sql=@sql+' from ygb where yg_zhongdian='+@dian
if @bumen<>''
 begin
   set @sql=@sql+' and yg_bumen='+@bumen
 end

exec (@sql)
GO


-- ----------------------------
-- Primary Key structure for table daiyub
-- ----------------------------
ALTER TABLE [dbo].[daiyub] ADD CONSTRAINT [PK_daiyudjb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table ddbreakrule
-- ----------------------------
ALTER TABLE [dbo].[ddbreakrule] ADD CONSTRAINT [PK__ddbreakr__3214EC273F466844] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table ddcarman
-- ----------------------------
ALTER TABLE [dbo].[ddcarman] ADD CONSTRAINT [PK_ddcarman] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table ddrefuel
-- ----------------------------
ALTER TABLE [dbo].[ddrefuel] ADD CONSTRAINT [PK__ddrefuel__3214EC2731EC6D26] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table ddservice
-- ----------------------------
ALTER TABLE [dbo].[ddservice] ADD CONSTRAINT [PK__ddservic__3214EC27398D8EEE] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table EquBasic
-- ----------------------------
ALTER TABLE [dbo].[EquBasic] ADD CONSTRAINT [PK__EquBasic__3214EC27056ECC6A] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table EquBasicImage
-- ----------------------------
ALTER TABLE [dbo].[EquBasicImage] ADD CONSTRAINT [PK__EquBasic__3214EC27084B3915] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table EquConserve
-- ----------------------------
ALTER TABLE [dbo].[EquConserve] ADD CONSTRAINT [PK__EquConse__3214EC270B27A5C0] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table EquSetting
-- ----------------------------
ALTER TABLE [dbo].[EquSetting] ADD CONSTRAINT [PK__EquConse__3214EC2714B10FFA] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table fafenb
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[fafenb] (
  [fj_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table fafenb
-- ----------------------------
ALTER TABLE [dbo].[fafenb] ADD CONSTRAINT [PK_fafenb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table gdb
-- ----------------------------
ALTER TABLE [dbo].[gdb] ADD CONSTRAINT [PK_gdb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table gwb
-- ----------------------------
ALTER TABLE [dbo].[gwb] ADD CONSTRAINT [PK_gwb_1] PRIMARY KEY CLUSTERED ([gw])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table jiaquerenb
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[jiaquerenb] (
  [qr_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table jiaquerenb
-- ----------------------------
ALTER TABLE [dbo].[jiaquerenb] ADD CONSTRAINT [PK_jiaquerenb] PRIMARY KEY CLUSTERED ([qr_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table jiaxiusetb
-- ----------------------------
ALTER TABLE [dbo].[jiaxiusetb] ADD CONSTRAINT [PK_jiaxiusetb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table jiejiab
-- ----------------------------
ALTER TABLE [dbo].[jiejiab] ADD CONSTRAINT [PK_jiejiab] PRIMARY KEY CLUSTERED ([zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table jigoudiguib
-- ----------------------------
ALTER TABLE [dbo].[jigoudiguib] ADD CONSTRAINT [PK_jigoudiguib] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kq_yuejie
-- ----------------------------
ALTER TABLE [dbo].[kq_yuejie] ADD CONSTRAINT [PK_chushihuab] PRIMARY KEY CLUSTERED ([zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table kqb
-- ----------------------------
CREATE NONCLUSTERED INDEX [kqygid]
ON [dbo].[kqb] (
  [k_ygid] ASC
)
WITH (
  ALLOW_PAGE_LOCKS = OFF
)
GO


-- ----------------------------
-- Primary Key structure for table kqb
-- ----------------------------
ALTER TABLE [dbo].[kqb] ADD CONSTRAINT [PK_kqb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table kqb1
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[kqb1] (
  [k_ygid] ASC,
  [k_sri] ASC
)
WITH (
  ALLOW_PAGE_LOCKS = OFF
)
GO


-- ----------------------------
-- Primary Key structure for table kqb1
-- ----------------------------
ALTER TABLE [dbo].[kqb1] ADD CONSTRAINT [PK_kqb3] PRIMARY KEY CLUSTERED ([k_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqb2
-- ----------------------------
ALTER TABLE [dbo].[kqb2] ADD CONSTRAINT [PK_kqb2] PRIMARY KEY CLUSTERED ([k_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table kqbeizhu
-- ----------------------------
CREATE NONCLUSTERED INDEX [kq_ygid]
ON [dbo].[kqbeizhu] (
  [am_beizhu] ASC,
  [dangtiankqriqi] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table kqbeizhu
-- ----------------------------
ALTER TABLE [dbo].[kqbeizhu] ADD CONSTRAINT [PK_kqbeizhu] PRIMARY KEY CLUSTERED ([kb_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqbeizhuleibie
-- ----------------------------
ALTER TABLE [dbo].[kqbeizhuleibie] ADD CONSTRAINT [PK_kqbeizhuleibie] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqfsb
-- ----------------------------
ALTER TABLE [dbo].[kqfsb] ADD CONSTRAINT [PK_kqfsb] PRIMARY KEY CLUSTERED ([f_zhuti])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table kqjfb
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[kqjfb] (
  [jf_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table kqjfleib
-- ----------------------------
ALTER TABLE [dbo].[kqjfleib] ADD CONSTRAINT [PK_kqjfleib] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqpmb
-- ----------------------------
ALTER TABLE [dbo].[kqpmb] ADD CONSTRAINT [PK_kqpmb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqpmb_paichu
-- ----------------------------
ALTER TABLE [dbo].[kqpmb_paichu] ADD CONSTRAINT [PK_kqpmb_paichu] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table kqzb
-- ----------------------------
ALTER TABLE [dbo].[kqzb] ADD CONSTRAINT [PK_kqzb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table lizhipib
-- ----------------------------
ALTER TABLE [dbo].[lizhipib] ADD CONSTRAINT [PK_lizhipib] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table lizhipirenb
-- ----------------------------
ALTER TABLE [dbo].[lizhipirenb] ADD CONSTRAINT [PK_lizhipirenb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table lizhispb
-- ----------------------------
ALTER TABLE [dbo].[lizhispb] ADD CONSTRAINT [PK_lizhispb] PRIMARY KEY CLUSTERED ([lz_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table lzb
-- ----------------------------
ALTER TABLE [dbo].[lzb] ADD CONSTRAINT [PK_lzb] PRIMARY KEY CLUSTERED ([zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table lzleibieb
-- ----------------------------
ALTER TABLE [dbo].[lzleibieb] ADD CONSTRAINT [PK_lzleibieb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table message
-- ----------------------------
ALTER TABLE [dbo].[message] ADD CONSTRAINT [PK_message_1] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table oacdqxb
-- ----------------------------
CREATE NONCLUSTERED INDEX [jiansuo]
ON [dbo].[oacdqxb] (
  [oa_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table oacdqxb
-- ----------------------------
ALTER TABLE [dbo].[oacdqxb] ADD CONSTRAINT [PK_oacdqxb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table qjb
-- ----------------------------
ALTER TABLE [dbo].[qjb] ADD CONSTRAINT [PK_qjb] PRIMARY KEY CLUSTERED ([qj_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table qjmxb
-- ----------------------------
ALTER TABLE [dbo].[qjmxb] ADD CONSTRAINT [PK_qjmxb] PRIMARY KEY CLUSTERED ([zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_CALENDARS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_CALENDARS] ADD CONSTRAINT [PK_QRTZ_CALENDARS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [CALENDAR_NAME])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_CRON_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD CONSTRAINT [PK_QRTZ_CRON_TRIGGERS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_FIRED_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] ADD CONSTRAINT [PK_QRTZ_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [ENTRY_ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_JOB_DETAILS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] ADD CONSTRAINT [PK_QRTZ_JOB_DETAILS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [JOB_NAME], [JOB_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_LOCKS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_LOCKS] ADD CONSTRAINT [PK_QRTZ_LOCKS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [LOCK_NAME])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_PAUSED_TRIGGER_GRPS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] ADD CONSTRAINT [PK_QRTZ_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [TRIGGER_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_SCHEDULER_STATE
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] ADD CONSTRAINT [PK_QRTZ_SCHEDULER_STATE] PRIMARY KEY CLUSTERED ([SCHED_NAME], [INSTANCE_NAME])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_SIMPLE_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD CONSTRAINT [PK_QRTZ_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_SIMPROP_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ADD CONSTRAINT [PK_QRTZ_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table QRTZ_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD CONSTRAINT [PK_QRTZ_TRIGGERS] PRIMARY KEY CLUSTERED ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table qxb
-- ----------------------------
ALTER TABLE [dbo].[qxb] ADD CONSTRAINT [PK_yhb] PRIMARY KEY CLUSTERED ([qx_ygid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table renlian_token
-- ----------------------------
ALTER TABLE [dbo].[renlian_token] ADD CONSTRAINT [PK_renlian_token] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table rzb
-- ----------------------------
ALTER TABLE [dbo].[rzb] ADD CONSTRAINT [PK_rzb] PRIMARY KEY CLUSTERED ([rz_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sbsetb
-- ----------------------------
ALTER TABLE [dbo].[sbsetb] ADD CONSTRAINT [PK_sbsetb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sbsetb_bumen
-- ----------------------------
ALTER TABLE [dbo].[sbsetb_bumen] ADD CONSTRAINT [PK_sbsetb_bumen] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sbsetb_teshu
-- ----------------------------
ALTER TABLE [dbo].[sbsetb_teshu] ADD CONSTRAINT [PK_sbsetb_teshu] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table shenpitib
-- ----------------------------
ALTER TABLE [dbo].[shenpitib] ADD CONSTRAINT [PK_shenpitib] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table SYS_ROLE
-- ----------------------------
ALTER TABLE [dbo].[SYS_ROLE] ADD CONSTRAINT [PK_SYS_ROLE] PRIMARY KEY CLUSTERED ([ROLEID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table sysdiagrams
-- ----------------------------
ALTER TABLE [dbo].[sysdiagrams] ADD CONSTRAINT [UK_principal_name] UNIQUE NONCLUSTERED ([principal_id] ASC, [name] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sysdiagrams
-- ----------------------------
ALTER TABLE [dbo].[sysdiagrams] ADD CONSTRAINT [PK__sysdiagrams__49C3F6B7] PRIMARY KEY CLUSTERED ([diagram_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_audio_info
-- ----------------------------
ALTER TABLE [dbo].[T_audio_info] ADD CONSTRAINT [UQ__T_audio___5E92B9863E723F9C] UNIQUE NONCLUSTERED ([audioId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_audio_info
-- ----------------------------
ALTER TABLE [dbo].[T_audio_info] ADD CONSTRAINT [PK__T_audio___3213E83F3B95D2F1] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_audio_time
-- ----------------------------
ALTER TABLE [dbo].[T_audio_time] ADD CONSTRAINT [AUDIO_TIME_UMIQUE] UNIQUE NONCLUSTERED ([audioId] ASC, [userId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_audio_time
-- ----------------------------
ALTER TABLE [dbo].[T_audio_time] ADD CONSTRAINT [PK__T_audio___3213E83F4336F4B9] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_audio_user
-- ----------------------------
ALTER TABLE [dbo].[T_audio_user] ADD CONSTRAINT [PK__T_audio___3213E83F4707859D] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_book_info
-- ----------------------------
ALTER TABLE [dbo].[T_book_info] ADD CONSTRAINT [UQ__T_book_i__8BE5A10C15702A09] UNIQUE NONCLUSTERED ([bookId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_book_info
-- ----------------------------
ALTER TABLE [dbo].[T_book_info] ADD CONSTRAINT [PK__T_book_i__3213E83F1293BD5E] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_book_time
-- ----------------------------
ALTER TABLE [dbo].[T_book_time] ADD CONSTRAINT [PK__T_book_t__3213E83F1A34DF26] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_book_user
-- ----------------------------
ALTER TABLE [dbo].[T_book_user] ADD CONSTRAINT [PK__T_book_u__3213E83F1E05700A] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_class_info
-- ----------------------------
ALTER TABLE [dbo].[T_class_info] ADD CONSTRAINT [PK_T_class_info] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_classFormInfo
-- ----------------------------
ALTER TABLE [dbo].[T_classFormInfo] ADD CONSTRAINT [PK_T_classFormInfo] PRIMARY KEY CLUSTERED ([classFormID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_ClassPlan
-- ----------------------------
ALTER TABLE [dbo].[T_ClassPlan] ADD CONSTRAINT [PK__T_ClassP__3213E83F4924D839] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table t_classTypeInfo
-- ----------------------------
ALTER TABLE [dbo].[t_classTypeInfo] ADD CONSTRAINT [PK_t_classTypeInfo] PRIMARY KEY CLUSTERED ([classTypeID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_fileInfo
-- ----------------------------
ALTER TABLE [dbo].[T_fileInfo] ADD CONSTRAINT [PK_T_fileInfo] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_integral_info
-- ----------------------------
ALTER TABLE [dbo].[T_integral_info] ADD CONSTRAINT [UNIQUE_OTHNERID_USER] UNIQUE NONCLUSTERED ([otherId] ASC, [user] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_integral_info
-- ----------------------------
ALTER TABLE [dbo].[T_integral_info] ADD CONSTRAINT [PK__T_integr__3213E83F7E8CC4B1] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_integral_set
-- ----------------------------
ALTER TABLE [dbo].[T_integral_set] ADD CONSTRAINT [UNIQUE_KEY_OHTERID] UNIQUE NONCLUSTERED ([otherId] ASC, [type] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_integral_set
-- ----------------------------
ALTER TABLE [dbo].[T_integral_set] ADD CONSTRAINT [PK__T_integr__3213E83F75035A77] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_jobInfo
-- ----------------------------
ALTER TABLE [dbo].[T_jobInfo] ADD CONSTRAINT [PK_T_jobInfo] PRIMARY KEY CLUSTERED ([jobID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_Kt_Comment
-- ----------------------------
ALTER TABLE [dbo].[T_Kt_Comment] ADD CONSTRAINT [PK__T_Kt_Com__3213E83F2E3BD7D3] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_leave_word
-- ----------------------------
ALTER TABLE [dbo].[T_leave_word] ADD CONSTRAINT [PK__T_leave___3213E83F60083D91] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_loginfo
-- ----------------------------
ALTER TABLE [dbo].[T_loginfo] ADD CONSTRAINT [PK_T_loginfo] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_personinfo
-- ----------------------------
ALTER TABLE [dbo].[T_personinfo] ADD CONSTRAINT [PK_T_personinfo] PRIMARY KEY CLUSTERED ([personID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_sign_log
-- ----------------------------
ALTER TABLE [dbo].[T_sign_log] ADD CONSTRAINT [PK__T_sign_l__3213E83F5832119F] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_signinfo
-- ----------------------------
ALTER TABLE [dbo].[T_signinfo] ADD CONSTRAINT [PK_T_signinfo] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_staffJobInfo
-- ----------------------------
ALTER TABLE [dbo].[T_staffJobInfo] ADD CONSTRAINT [PK_T_staffJobInfo] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_tag
-- ----------------------------
ALTER TABLE [dbo].[T_tag] ADD CONSTRAINT [PK__T_tag__3213E83F51BA1E3A] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_tag_user
-- ----------------------------
ALTER TABLE [dbo].[T_tag_user] ADD CONSTRAINT [PK__T_tag_us__3213E83F558AAF1E] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_video_info
-- ----------------------------
ALTER TABLE [dbo].[T_video_info] ADD CONSTRAINT [PK__T_video___3213E83F66B53B20] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Uniques structure for table T_video_time
-- ----------------------------
ALTER TABLE [dbo].[T_video_time] ADD CONSTRAINT [UNIQUE_VIDEOID_USER] UNIQUE NONCLUSTERED ([videoId] ASC, [userId] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_video_time
-- ----------------------------
ALTER TABLE [dbo].[T_video_time] ADD CONSTRAINT [PK__T_video___3213E83F5A4F643B] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_video_user
-- ----------------------------
ALTER TABLE [dbo].[T_video_user] ADD CONSTRAINT [PK__T_video___3213E83F6A85CC04] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table T_videobook_cate
-- ----------------------------
ALTER TABLE [dbo].[T_videobook_cate] ADD CONSTRAINT [PK__T_videob__3213E83F04459E07] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table txlb
-- ----------------------------
ALTER TABLE [dbo].[txlb] ADD CONSTRAINT [PK_txlb] PRIMARY KEY CLUSTERED ([tx_ygid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table wqdkb
-- ----------------------------
ALTER TABLE [dbo].[wqdkb] ADD CONSTRAINT [PK_wqdkb] PRIMARY KEY CLUSTERED ([wq_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xiabanset
-- ----------------------------
ALTER TABLE [dbo].[xiabanset] ADD CONSTRAINT [PK_xiabanset] PRIMARY KEY CLUSTERED ([riqi])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table xinxiqxb
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[xinxiqxb] (
  [qx_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table xinxiqxset
-- ----------------------------
ALTER TABLE [dbo].[xinxiqxset] ADD CONSTRAINT [PK_xinxiqxset] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xtfenleib
-- ----------------------------
ALTER TABLE [dbo].[xtfenleib] ADD CONSTRAINT [PK_xtfenleib] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table xxb
-- ----------------------------
CREATE NONCLUSTERED INDEX [changyong]
ON [dbo].[xxb] (
  [xx_ygid] ASC,
  [xx_shibie] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table xxb
-- ----------------------------
ALTER TABLE [dbo].[xxb] ADD CONSTRAINT [PK_xxb] PRIMARY KEY CLUSTERED ([xx_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xxtjb
-- ----------------------------
ALTER TABLE [dbo].[xxtjb] ADD CONSTRAINT [PK_xxtjb] PRIMARY KEY CLUSTERED ([xxtj_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xzdjsetb
-- ----------------------------
ALTER TABLE [dbo].[xzdjsetb] ADD CONSTRAINT [PK_xzdjsetb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xzpjb
-- ----------------------------
ALTER TABLE [dbo].[xzpjb] ADD CONSTRAINT [PK_xzpjb] PRIMARY KEY CLUSTERED ([xz_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xzpmb
-- ----------------------------
ALTER TABLE [dbo].[xzpmb] ADD CONSTRAINT [PK_xzpmb] PRIMARY KEY CLUSTERED ([pm_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xzrib
-- ----------------------------
ALTER TABLE [dbo].[xzrib] ADD CONSTRAINT [PK_xzrib] PRIMARY KEY CLUSTERED ([xz_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table xzsetb
-- ----------------------------
ALTER TABLE [dbo].[xzsetb] ADD CONSTRAINT [PK_xzsetb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table ydb
-- ----------------------------
CREATE NONCLUSTERED INDEX [yd_ygid]
ON [dbo].[ydb] (
  [yd_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table ydb
-- ----------------------------
ALTER TABLE [dbo].[ydb] ADD CONSTRAINT [PK_ydb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table ygb
-- ----------------------------
CREATE NONCLUSTERED INDEX [youhua]
ON [dbo].[ygb] (
  [yg_zaizhi] ASC,
  [yg_zhongdian] ASC,
  [yg_bumen] ASC,
  [yg_zaigang] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table ygb
-- ----------------------------
ALTER TABLE [dbo].[ygb] ADD CONSTRAINT [PK_ygb] PRIMARY KEY CLUSTERED ([yg_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table ygb_jiaoyu
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[ygb_jiaoyu] (
  [jy_ygid] ASC
)
GO


-- ----------------------------
-- Indexes structure for table ygb_jiashu
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[ygb_jiashu] (
  [js_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table ygb_jiben
-- ----------------------------
ALTER TABLE [dbo].[ygb_jiben] ADD CONSTRAINT [PK_ygb_jiben] PRIMARY KEY CLUSTERED ([jb_ygid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table ygb_jingli
-- ----------------------------
CREATE NONCLUSTERED INDEX [ygid]
ON [dbo].[ygb_jingli] (
  [gz_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table ygjbxx
-- ----------------------------
ALTER TABLE [dbo].[ygjbxx] ADD CONSTRAINT [PK_ygjbxx] PRIMARY KEY CLUSTERED ([yg_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table ygtb
-- ----------------------------
ALTER TABLE [dbo].[ygtb] ADD CONSTRAINT [PK_ygtb] PRIMARY KEY CLUSTERED ([ygt_ygid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table yjfafenb
-- ----------------------------
ALTER TABLE [dbo].[yjfafenb] ADD CONSTRAINT [PK_yjfafenb] PRIMARY KEY CLUSTERED ([yj_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table zfb
-- ----------------------------
ALTER TABLE [dbo].[zfb] ADD CONSTRAINT [PK_zfb] PRIMARY KEY CLUSTERED ([zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table zwb
-- ----------------------------
ALTER TABLE [dbo].[zwb] ADD CONSTRAINT [PK_zwb] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Indexes structure for table zwkb
-- ----------------------------
CREATE NONCLUSTERED INDEX [youhua]
ON [dbo].[zwkb] (
  [zw_ygid] ASC
)
GO


-- ----------------------------
-- Primary Key structure for table zwkb
-- ----------------------------
ALTER TABLE [dbo].[zwkb] ADD CONSTRAINT [PK_zwkb] PRIMARY KEY CLUSTERED ([zw_zhu])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Foreign Keys structure for table QRTZ_CRON_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD CONSTRAINT [FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) REFERENCES [dbo].[QRTZ_TRIGGERS] ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) ON DELETE CASCADE ON UPDATE NO ACTION
GO


-- ----------------------------
-- Foreign Keys structure for table QRTZ_SIMPLE_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD CONSTRAINT [FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) REFERENCES [dbo].[QRTZ_TRIGGERS] ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) ON DELETE CASCADE ON UPDATE NO ACTION
GO


-- ----------------------------
-- Foreign Keys structure for table QRTZ_SIMPROP_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ADD CONSTRAINT [FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) REFERENCES [dbo].[QRTZ_TRIGGERS] ([SCHED_NAME], [TRIGGER_NAME], [TRIGGER_GROUP]) ON DELETE CASCADE ON UPDATE NO ACTION
GO


-- ----------------------------
-- Foreign Keys structure for table QRTZ_TRIGGERS
-- ----------------------------
ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS] FOREIGN KEY ([SCHED_NAME], [JOB_NAME], [JOB_GROUP]) REFERENCES [dbo].[QRTZ_JOB_DETAILS] ([SCHED_NAME], [JOB_NAME], [JOB_GROUP]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO

